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

Delete single retry

This commit is contained in:
Ezekiel Templin 2012-06-12 21:59:43 -04:00
parent 482eea0f0e
commit 41f68f99ca
2 changed files with 18 additions and 2 deletions

View file

@ -199,9 +199,9 @@ module Sidekiq
halt 404 unless params[:score] halt 404 unless params[:score]
score = params[:score].to_f score = params[:score].to_f
if params['retry'] if params['retry']
process_score(score, :retry) process_score('retry', score, :retry)
elsif params['delete'] elsif params['delete']
process_score(score, :delete) process_score('retry', score, :delete)
end end
redirect root_path redirect root_path
end end

View file

@ -104,6 +104,22 @@ class TestWeb < MiniTest::Unit::TestCase
assert_equal 200, last_response.status assert_equal 200, last_response.status
assert_match /HardWorker/, last_response.body assert_match /HardWorker/, last_response.body
end end
it 'can delete a single retry' do
Sidekiq.redis do |conn|
conn.del('retry')
end
score = add_retry[1].to_s
post "/retries/#{score}", 'delete' => 'Delete'
assert_equal 302, last_response.status
assert_equal 'http://example.org/', last_response.header['Location']
get "/retries"
assert_equal 200, last_response.status
refute_match /#{score}/, last_response.body
end
def add_scheduled def add_scheduled
msg = { 'class' => 'HardWorker', msg = { 'class' => 'HardWorker',