mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Don't allow delay usage on Sidekiq::Worker
This commit is contained in:
parent
f277cae8bc
commit
242109e872
2 changed files with 14 additions and 2 deletions
|
@ -38,6 +38,18 @@ module Sidekiq
|
|||
|
||||
module ClassMethods
|
||||
|
||||
def delay(*args)
|
||||
raise ArgumentError, "Do not call .delay on a Sidekiq::Worker class, call .perform_async"
|
||||
end
|
||||
|
||||
def delay_for(*args)
|
||||
raise ArgumentError, "Do not call .delay_for on a Sidekiq::Worker class, call .perform_in"
|
||||
end
|
||||
|
||||
def delay_until(*args)
|
||||
raise ArgumentError, "Do not call .delay_until on a Sidekiq::Worker class, call .perform_at"
|
||||
end
|
||||
|
||||
def perform_async(*args)
|
||||
client_push('class' => self, 'args' => args)
|
||||
end
|
||||
|
|
|
@ -202,10 +202,10 @@ class TestApi < Sidekiq::Test
|
|||
end
|
||||
|
||||
it 'unwraps delayed jobs' do
|
||||
ApiWorker.delay.foo(1,2,3)
|
||||
Sidekiq::Queue.delay.foo(1,2,3)
|
||||
q = Sidekiq::Queue.new
|
||||
x = q.first
|
||||
assert_equal "TestApi::ApiWorker.foo", x.display_class
|
||||
assert_equal "Sidekiq::Queue.foo", x.display_class
|
||||
assert_equal [1,2,3], x.display_args
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue