Method: WarouzServer::WorkerManager#stop_worker_threads

Defined in:
lib/warouz_server/worker_manager.rb

#stop_worker_threadsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/warouz_server/worker_manager.rb', line 19

def stop_worker_threads
  return if worker_threads.empty?
  worker_instances.each do |worker_instance|
    worker_instance.stop
  end
  worker_threads.each do |worker_thread|
    worker_thread.join(5)
    if worker_thread.alive?
      worker_thread.terminate
      logger.warn("#{worker_thread.object_id} was to slow to stop, killed.")
    else
      logger.info("#{worker_thread.object_id} stopped.")
    end
  end
  nil
end