lib/shoryuken/launcher.rb in shoryuken-2.1.3 vs lib/shoryuken/launcher.rb in shoryuken-3.0.0
- old
+ new
@@ -1,42 +1,19 @@
module Shoryuken
class Launcher
- include Celluloid
include Util
- trap_exit :actor_died
-
- attr_accessor :manager
-
def initialize
- @condvar = Celluloid::Condition.new
- @manager = Shoryuken::Manager.new_link(@condvar)
-
- @done = false
-
- manager.fetcher = Shoryuken::Fetcher.new
- manager.polling_strategy = Shoryuken.options[:polling_strategy].new(Shoryuken.queues)
+ @manager = Shoryuken::Manager.new(Shoryuken::Fetcher.new,
+ Shoryuken.options[:polling_strategy].new(Shoryuken.queues))
end
def stop(options = {})
- watchdog('Launcher#stop') do
- @done = true
-
- manager.async.stop(shutdown: !!options[:shutdown], timeout: Shoryuken.options[:timeout])
- @condvar.wait
- manager.terminate
- end
+ @manager.stop(shutdown: !options[:shutdown].nil?,
+ timeout: Shoryuken.options[:timeout])
end
def run
- watchdog('Launcher#run') do
- manager.async.start
- end
- end
-
- def actor_died(actor, reason)
- return if @done
- logger.warn { "Shoryuken died due to the following error, cannot recover, process exiting: #{reason}" }
- exit 1
+ @manager.start
end
end
end