1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Extract procline feature from Manager to Launcher.

We don't want to touch the process name if we're integrating
Sidekiq into existing process, so better not to put procline
assignment in Manager, but in CLI where we launch standalone
Sidekiq process.
This commit is contained in:
Lin Jen-Shin 2013-01-30 00:43:44 +08:00
parent f17e94acc8
commit 13c940eb7d
3 changed files with 10 additions and 6 deletions

View file

@ -91,6 +91,7 @@ module Sidekiq
end
@launcher = Sidekiq::Launcher.new(options)
launcher.procline(options[:tag] ? "#{options[:tag]} " : '')
begin
if options[:profile]

View file

@ -22,5 +22,10 @@ module Sidekiq
manager.async.stop(:shutdown => true, :timeout => options[:timeout])
manager.wait(:shutdown)
end
def procline(tag)
$0 = manager.procline(tag)
manager.after(5) { procline(tag) }
end
end
end

View file

@ -27,7 +27,6 @@ module Sidekiq
@busy = []
@fetcher = Fetcher.new(current_actor, options)
@ready = @count.times.map { Processor.new_link(current_actor) }
procline(options[:tag] ? "#{options[:tag]} " : '')
end
def stop(options={})
@ -103,6 +102,10 @@ module Sidekiq
end
end
def procline(tag)
"sidekiq #{Sidekiq::VERSION} #{tag}[#{@busy.size} of #{@count} busy]#{stopped? ? ' stopping' : ''}"
end
private
def hard_shutdown_in(delay)
@ -156,10 +159,5 @@ module Sidekiq
def stopped?
@done
end
def procline(tag)
$0 = "sidekiq #{Sidekiq::VERSION} #{tag}[#{@busy.size} of #{@count} busy]#{stopped? ? ' stopping' : ''}"
after(5) { procline(tag) }
end
end
end