mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge pull request #2757 from jcarlson/quiet-ui
Add "quiet" label to UI when process is quieted"
This commit is contained in:
commit
6cebeef6c8
3 changed files with 15 additions and 6 deletions
|
@ -674,13 +674,13 @@ module Sidekiq
|
|||
# you'll be happier this way
|
||||
result = conn.pipelined do
|
||||
procs.each do |key|
|
||||
conn.hmget(key, 'info', 'busy', 'beat')
|
||||
conn.hmget(key, 'info', 'busy', 'beat', 'quiet')
|
||||
end
|
||||
end
|
||||
|
||||
result.each do |info, busy, at_s|
|
||||
result.each do |info, busy, at_s, quiet|
|
||||
hash = Sidekiq.load_json(info)
|
||||
yield Process.new(hash.merge('busy' => busy.to_i, 'beat' => at_s.to_f))
|
||||
yield Process.new(hash.merge('busy' => busy.to_i, 'beat' => at_s.to_f, 'quiet' => quiet))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -739,6 +739,10 @@ module Sidekiq
|
|||
signal('TTIN')
|
||||
end
|
||||
|
||||
def stopping?
|
||||
self['quiet'] == 'true'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def signal(sig)
|
||||
|
|
|
@ -95,7 +95,7 @@ module Sidekiq
|
|||
_, _, _, msg = Sidekiq.redis do |conn|
|
||||
conn.pipelined do
|
||||
conn.sadd('processes', key)
|
||||
conn.hmset(key, 'info', json, 'busy', Processor::WORKER_STATE.size, 'beat', Time.now.to_f)
|
||||
conn.hmset(key, 'info', json, 'busy', Processor::WORKER_STATE.size, 'beat', Time.now.to_f, 'quiet', @done)
|
||||
conn.expire(key, 60)
|
||||
conn.rpop("#{key}-signals")
|
||||
end
|
||||
|
@ -127,7 +127,7 @@ module Sidekiq
|
|||
'concurrency' => @options[:concurrency],
|
||||
'queues' => @options[:queues].uniq,
|
||||
'labels' => @options[:labels],
|
||||
'identity' => k,
|
||||
'identity' => k
|
||||
}
|
||||
# this data doesn't change so dump it to a string
|
||||
# now so we don't need to dump it every heartbeat.
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<% process.labels.each do |label| %>
|
||||
<span class="label label-info"><%= label %></span>
|
||||
<% end %>
|
||||
<% if process.stopping? %>
|
||||
<span class="label label-danger">Quiet</span>
|
||||
<% end %>
|
||||
<br>
|
||||
<b><%= "#{t('Queues')}: " %></b>
|
||||
<%= process['queues'] * ", " %>
|
||||
|
@ -42,7 +45,9 @@
|
|||
<form method="POST">
|
||||
<%= csrf_tag %>
|
||||
<input type="hidden" name="identity" value="<%= process['identity'] %>"/>
|
||||
<button class="btn btn-warn" type="submit" name="quiet" value="1"><%= t('Quiet') %></button>
|
||||
<% unless process.stopping? %>
|
||||
<button class="btn btn-warn" type="submit" name="quiet" value="1"><%= t('Quiet') %></button>
|
||||
<% end %>
|
||||
<button class="btn btn-danger" type="submit" name="stop" value="1"><%= t('Stop') %></button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue