From be84d53c7f3b6affc3c771ede9f999579ca95990 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Fri, 7 Sep 2012 08:35:27 -0700 Subject: [PATCH] Rejigger resque helpers to remove perform_in_queue --- lib/sidekiq/client.rb | 14 +++++++------- lib/sidekiq/worker.rb | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/sidekiq/client.rb b/lib/sidekiq/client.rb index 0b5d1532..e6b59a6a 100644 --- a/lib/sidekiq/client.rb +++ b/lib/sidekiq/client.rb @@ -65,22 +65,22 @@ module Sidekiq pushed ? item['jid'] : nil end - # Resque compatibility helpers. + # Resque compatibility helpers. # - # Example usage: - # Sidekiq::Client.enqueue(MyWorker, 'foo', 1, :bat => 'bar') + # Example usage: + # 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') + # Example usage: + # 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 diff --git a/lib/sidekiq/worker.rb b/lib/sidekiq/worker.rb index c798f076..95d8bd37 100644 --- a/lib/sidekiq/worker.rb +++ b/lib/sidekiq/worker.rb @@ -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)