mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add "clear workers" button back to UI
This commit is contained in:
parent
de616bb188
commit
43a5dea301
2 changed files with 16 additions and 0 deletions
|
@ -36,6 +36,15 @@ module Sidekiq
|
||||||
|
|
||||||
helpers do
|
helpers do
|
||||||
|
|
||||||
|
def reset_worker_list
|
||||||
|
Sidekiq.redis do |conn|
|
||||||
|
workers = conn.smembers('workers')
|
||||||
|
workers.each do |name|
|
||||||
|
conn.srem('workers', name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def workers
|
def workers
|
||||||
@workers ||= begin
|
@workers ||= begin
|
||||||
Sidekiq.redis do |conn|
|
Sidekiq.redis do |conn|
|
||||||
|
@ -127,6 +136,11 @@ module Sidekiq
|
||||||
slim :queue
|
slim :queue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
post "/reset" do
|
||||||
|
reset_worker_list
|
||||||
|
redirect root_path
|
||||||
|
end
|
||||||
|
|
||||||
post "/queues/:name" do
|
post "/queues/:name" do
|
||||||
Sidekiq.redis do |conn|
|
Sidekiq.redis do |conn|
|
||||||
conn.del("queue:#{params[:name]}")
|
conn.del("queue:#{params[:name]}")
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
td= msg['payload']['class']
|
td= msg['payload']['class']
|
||||||
td= msg['payload']['args'].inspect[0..100]
|
td= msg['payload']['args'].inspect[0..100]
|
||||||
td== relative_time(Time.parse(msg['run_at']))
|
td== relative_time(Time.parse(msg['run_at']))
|
||||||
|
form action="#{root_path}reset" method="post"
|
||||||
|
button.btn type="submit" title="If you kill -9 Sidekiq, this table can fill up with old data." Clear worker list
|
||||||
|
|
||||||
#queues.tab-pane
|
#queues.tab-pane
|
||||||
table class="table table-striped table-bordered"
|
table class="table table-striped table-bordered"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue