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

Fix race conditions in Web UI actions

This commit is contained in:
Mike Perham 2013-08-15 19:52:50 -07:00
parent be6ece9a45
commit 484d35e18b
3 changed files with 25 additions and 13 deletions

View file

@ -1,3 +1,9 @@
2.13.2
-----------
- Fix more race conditions in Web UI actions
2.13.1 2.13.1
----------- -----------

View file

@ -1,3 +1,3 @@
module Sidekiq module Sidekiq
VERSION = "2.13.1" VERSION = "2.13.2"
end end

View file

@ -238,10 +238,12 @@ module Sidekiq
post "/retries/:key" do post "/retries/:key" do
halt 404 unless params['key'] halt 404 unless params['key']
job = Sidekiq::RetrySet.new.fetch(*parse_params(params['key'])).first job = Sidekiq::RetrySet.new.fetch(*parse_params(params['key'])).first
if params['retry'] if job
job.retry if params['retry']
elsif params['delete'] job.retry
job.delete elsif params['delete']
job.delete
end
end end
redirect "#{root_path}retries" redirect "#{root_path}retries"
end end
@ -265,10 +267,12 @@ module Sidekiq
params['key'].each do |key| params['key'].each do |key|
job = Sidekiq::ScheduledSet.new.fetch(*parse_params(key)).first job = Sidekiq::ScheduledSet.new.fetch(*parse_params(key)).first
if params['delete'] if job
job.delete if params['delete']
elsif params['add_to_queue'] job.delete
job.add_to_queue elsif params['add_to_queue']
job.add_to_queue
end
end end
end end
redirect "#{root_path}scheduled" redirect "#{root_path}scheduled"
@ -277,10 +281,12 @@ module Sidekiq
post "/scheduled/:key" do post "/scheduled/:key" do
halt 404 unless params['key'] halt 404 unless params['key']
job = Sidekiq::ScheduledSet.new.fetch(*parse_params(params['key'])).first job = Sidekiq::ScheduledSet.new.fetch(*parse_params(params['key'])).first
if params['add_to_queue'] if job
job.add_to_queue if params['add_to_queue']
elsif params['delete'] job.add_to_queue
job.delete elsif params['delete']
job.delete
end
end end
redirect "#{root_path}scheduled" redirect "#{root_path}scheduled"
end end