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

Rejigger resque helpers to remove perform_in_queue

This commit is contained in:
Mike Perham 2012-09-07 08:35:27 -07:00
parent a270fd8dc1
commit be84d53c7f
2 changed files with 7 additions and 11 deletions

View file

@ -68,19 +68,19 @@ module Sidekiq
# Resque compatibility helpers.
#
# Example usage:
# Sidekiq::Client.enqueue(MyWorker, 'foo', 1, :bat => 'bar')
# Sidekiq::Client.enqueue(MyWorker, 'foo', 1, :bat => 'bar')
#
# Messages are enqueued to the 'default' queue.
#
def self.enqueue(klass, *args)
klass.perform_async(*args)
klass.client_push('class' => self, 'args' => args)
end
# Example usage:
# Sidekiq::Client.enqueue_to(:queue_name, MyWorker, 'foo', 1, :bat => 'bar')
# Sidekiq::Client.enqueue_to(:queue_name, MyWorker, 'foo', 1, :bat => 'bar')
#
def self.enqueue_to(queue, klass, *args)
klass.perform_in_queue(queue, *args)
klass.client_push('queue' => queue, 'class' => self, 'args' => args)
end
end
end

View file

@ -35,10 +35,6 @@ module Sidekiq
client_push('class' => self, 'args' => args)
end
def perform_in_queue(queue, *args)
client_push('queue' => queue, 'class' => self, 'args' => args)
end
def perform_in(interval, *args)
int = interval.to_f
ts = (int < 1_000_000_000 ? Time.now.to_f + int : int)