-
Notifications
You must be signed in to change notification settings - Fork 416
Closed
Labels
bugA bug in the library or documentation.A bug in the library or documentation.
Description
Consider the following code
#!/usr/bin/env ruby
require "concurrent"
class TaskObserver
def update(time, result, ex)
if ex.is_a?(Concurrent::TimeoutError)
print "(#{time}) Execution timed out\n"
end
end
end
puts "Creating tasks"
10.times do |x|
task = Concurrent::TimerTask.new(run_now: true, execution_interval: 20, timeout_interval: 5) do
sleep x*2
puts "#{x*2} finished"
end
task.add_observer(TaskObserver.new)
task.execute
end
sleep 60
puts "Terminated"Expected behaviour:
Creating tasks
0 finished
2 finished
4 finished
(2017-10-19 00:57:48 +0300) Execution timed out
(2017-10-19 00:57:48 +0300) Execution timed out
(2017-10-19 00:57:48 +0300) Execution timed out
(2017-10-19 00:57:48 +0300) Execution timed out
...
Real behavior:
Creating tasks
0 finished
2 finished
4 finished
6 finished
8 finished
10 finished
12 finished
14 finished
16 finished
18 finished
...
- Operating system: linux
concurrent-rubyversion: 1.0.5concurrent-ruby-extinstalled: noconcurrent-ruby-edgeused: no
Metadata
Metadata
Assignees
Labels
bugA bug in the library or documentation.A bug in the library or documentation.