Class: Sidekiq::CLI
Constant Summary collapse
- FOREVER =
2_000_000_000
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Methods included from Util
#constantize, #err, #log, #verbose, #watchdog
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
12 13 14 15 16 |
# File 'lib/sidekiq/cli.rb', line 12 def initialize validate! boot_rails end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sidekiq/cli.rb', line 20 def run ::Sidekiq::Client.redis = ConnectionPool.new { Redis.connect(:url => @options[:server]) } manager = Sidekiq::Manager.new(@options[:server], @options) begin log 'Starting processing, hit Ctrl-C to stop' manager.start! # HACK need to determine how to pause main thread while # waiting for signals. sleep FOREVER rescue Interrupt # TODO Need clean shutdown support from Celluloid log 'Shutting down, pausing 5 seconds to let workers finish...' manager.stop! manager.wait(:shutdown) end end |