mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
api cleanup
This commit is contained in:
parent
05cbc6333d
commit
c4e5b52676
2 changed files with 5 additions and 1 deletions
|
@ -29,7 +29,6 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def each(&block)
|
def each(&block)
|
||||||
# page thru the sorted set backwards so deleting entries doesn't screw up indexing
|
|
||||||
page = 0
|
page = 0
|
||||||
page_size = 50
|
page_size = 50
|
||||||
|
|
||||||
|
@ -99,6 +98,10 @@ module Sidekiq
|
||||||
@score = score
|
@score = score
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def retry_at
|
||||||
|
Time.at(@score)
|
||||||
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
count = Sidekiq.redis do |conn|
|
count = Sidekiq.redis do |conn|
|
||||||
conn.zremrangebyscore('retry', @score, @score)
|
conn.zremrangebyscore('retry', @score, @score)
|
||||||
|
|
|
@ -53,6 +53,7 @@ class TestApi < MiniTest::Unit::TestCase
|
||||||
assert_equal 'ApiWorker', retri.klass
|
assert_equal 'ApiWorker', retri.klass
|
||||||
assert_equal 'default', retri.queue
|
assert_equal 'default', retri.queue
|
||||||
assert_equal 'bob', retri.jid
|
assert_equal 'bob', retri.jid
|
||||||
|
assert_in_delta Time.now.to_f, retri.retry_at.to_f, 0.01
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can delete retries' do
|
it 'can delete retries' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue