Open
Description
Script as PoC:
puts "Start: #{Time.now}"
task = Concurrent::TimerTask.execute(execution_interval: 3) { puts "In task: #{Time.now}" }
sleep 4
task.shutdown
puts "Restart: #{Time.now}"
task.execute
sleep 6
task.shutdown
puts "End: #{Time.now}"
Example output:
Start: 2017-09-06 12:24:54 +0200
In task: 2017-09-06 12:24:57 +0200
Restart: 2017-09-06 12:24:58 +0200
In task: 2017-09-06 12:25:00 +0200
In task: 2017-09-06 12:25:01 +0200
In task: 2017-09-06 12:25:03 +0200
End: 2017-09-06 12:25:04 +0200
The tekst "In task: 2017-09-06 12:25:00 +0200" is not what I would expect here, this belongs to the first execution. The combination of shutdown and execute results in 1 extra execution of the first timer.
if you create a new TimerTask instead, the pending task is not executed.
- Operating system: linux
concurrent-ruby
version: 1.0.5concurrent-ruby-ext
installed: yesconcurrent-ruby-edge
used: no