Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
Timeout implementation for Crystal.
Add this to your application's shard.yml
:
dependencies:
timeout:
github: andrius/timeout
require "timeout"
Sample:
res = Timeout.timeout(0.1) do
puts "this line will be printed"
sleep 0.2
puts "this line won't be printed"
end
# will print false
puts "Result: #{res}"