mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Send the full process info on each heartbeat so transient timeouts don't lead to a process disappearing in Busy, fixes #1884
This commit is contained in:
parent
104343615a
commit
5de3ef4353
3 changed files with 14 additions and 14 deletions
|
@ -1,6 +1,8 @@
|
|||
3.2.2
|
||||
-----------
|
||||
|
||||
- Fix issue which could cause Sidekiq workers to disappear from the Busy
|
||||
tab while still being active [#1884]
|
||||
- Add "Back to App" button in Web UI. You can set the button link via
|
||||
`Sidekiq::Web.app_url = 'http://www.mysite.com'` [#1875, seuros]
|
||||
- Add process tag (`-g tag`) to the Busy page so you can differentiate processes at a glance. [seuros, #1878]
|
||||
|
|
|
@ -71,14 +71,10 @@ module Sidekiq
|
|||
'queues' => @options[:queues].uniq,
|
||||
'labels' => Sidekiq.options[:labels],
|
||||
}
|
||||
Sidekiq.redis do |conn|
|
||||
conn.multi do
|
||||
conn.sadd('processes', key)
|
||||
conn.hset(key, 'info', Sidekiq.dump_json(data))
|
||||
conn.expire(key, 60)
|
||||
end
|
||||
end
|
||||
manager.heartbeat(key, data)
|
||||
# this data doesn't change so dump it to a string
|
||||
# now so we don't need to dump it every heartbeat.
|
||||
json = Sidekiq.dump_json(data)
|
||||
manager.heartbeat(key, data, json)
|
||||
end
|
||||
|
||||
def stop_heartbeat
|
||||
|
@ -89,5 +85,6 @@ module Sidekiq
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -132,26 +132,27 @@ module Sidekiq
|
|||
@threads[proxy_id] = thr
|
||||
end
|
||||
|
||||
def heartbeat(key, data)
|
||||
def heartbeat(key, data, json)
|
||||
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(' ')
|
||||
|
||||
❤(key)
|
||||
❤(key, json)
|
||||
after(5) do
|
||||
heartbeat(key, data)
|
||||
heartbeat(key, data, json)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ❤(key)
|
||||
def ❤(key, json)
|
||||
begin
|
||||
_, _, msg = Sidekiq.redis do |conn|
|
||||
_, _, _, msg = Sidekiq.redis do |conn|
|
||||
conn.multi do
|
||||
conn.hmset(key, 'busy', @busy.size, 'beat', Time.now.to_f)
|
||||
conn.sadd('processes', key)
|
||||
conn.hmset(key, 'info', json, 'busy', @busy.size, 'beat', Time.now.to_f)
|
||||
conn.expire(key, 60)
|
||||
conn.rpop("#{key}-signals")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue