Closed
Description
Shutting down a timer task is not waiting for already executing tasks to finish. I talked to @headius and he encouraged me to open an issue since it is not clear if this is a feature or bug.
Example code:
require "rubygems"
require "bundler/setup"
require "concurrent"
tasks = 10.times.map do |s|
Concurrent::TimerTask.new(execution_interval: 1) do
sleep s
puts "s: #{s}\n"
end
end
begin
tasks.each { |t| t.execute }
sleep
rescue Interrupt
puts "Received INT"
puts "Shutting down tasks"
tasks.each { |t| t.shutdown }
ensure
puts "Releasing resources"
end