lib/jflow/cli.rb in jflow-0.4.1 vs lib/jflow/cli.rb in jflow-0.4.2

- old
+ new

@@ -42,18 +42,16 @@ # an exception to the thread to force the failure. # # Shutting down workers will take a exactly 60 secs in all cases. def shutdown_workers log "Sending kill signal to running threads. Please wait for current polling to finish" - kill_threads = [] worker_threads.each do |thread| thread.mark_for_shutdown - if thread.currently_working? - kill_threads << kill_thread(thread) + if thread.currently_working? && thread.alive? + thread.raise("Workers are going down!") end end - kill_threads.each(&:join) end private def setup @@ -71,18 +69,9 @@ stats = JFlow::Stats.new(@domain, @tasklist) loop do break if Thread.current.marked_for_shutdown? stats.tick sleep 30 - end - end - end - - def kill_thread(thread) - Thread.new do - sleep 60 - if thread.alive? - thread.raise("Workers are going down!") end end end def log(str) \ No newline at end of file