mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Indicate in procline that manager have stopped
This commit is contained in:
parent
7f5ba22f2e
commit
473de4da8f
2 changed files with 31 additions and 2 deletions
|
@ -133,13 +133,14 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def heartbeat(key, data)
|
||||
return if stopped?
|
||||
|
||||
proctitle = ['sidekiq', Sidekiq::VERSION]
|
||||
proctitle << data['tag'] unless data['tag'].empty?
|
||||
proctitle << "[#{@busy.size} of #{data['concurrency']} busy]"
|
||||
proctitle << 'stopping' if stopped?
|
||||
$0 = proctitle.join(' ')
|
||||
|
||||
return if stopped?
|
||||
|
||||
❤(key)
|
||||
after(5) do
|
||||
heartbeat(key, data)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require 'helper'
|
||||
require 'sidekiq/manager'
|
||||
require 'sidekiq/util'
|
||||
|
||||
class TestManager < Sidekiq::Test
|
||||
|
||||
|
@ -77,9 +78,36 @@ class TestManager < Sidekiq::Test
|
|||
fetcher.verify
|
||||
end
|
||||
|
||||
describe 'heartbeat' do
|
||||
describe 'proctitle' do
|
||||
it 'sets useful info' do
|
||||
mgr = Sidekiq::Manager.new(options)
|
||||
mgr.heartbeat('identity', heartbeat_data)
|
||||
|
||||
proctitle = $0
|
||||
assert_equal $0, "sidekiq #{Sidekiq::VERSION} myapp [0 of 3 busy]"
|
||||
$0 = proctitle
|
||||
end
|
||||
|
||||
it 'indicates when stopped' do
|
||||
mgr = Sidekiq::Manager.new(options)
|
||||
mgr.stop
|
||||
mgr.heartbeat('identity', heartbeat_data)
|
||||
|
||||
proctitle = $0
|
||||
assert_equal $0, "sidekiq #{Sidekiq::VERSION} myapp [0 of 3 busy] stopping"
|
||||
$0 = proctitle
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def options
|
||||
{ :concurrency => 3, :queues => ['default'] }
|
||||
end
|
||||
|
||||
def heartbeat_data
|
||||
{ 'concurrency' => 3, 'tag' => 'myapp' }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue