lib/backgrounded/handler/resque_handler.rb in backgrounded-0.4.1 vs lib/backgrounded/handler/resque_handler.rb in backgrounded-0.5.0
- old
+ new
@@ -2,16 +2,19 @@
module Backgrounded
module Handler
#enque requests in resque
class ResqueHandler
+ DEFAULT_QUEUE = 'backgrounded'
+ @@queue = DEFAULT_QUEUE
+
def request(object, method, *args)
+ @@queue = object.backgrounded_options[method.to_sym][:queue] || DEFAULT_QUEUE
Resque.enqueue(ResqueHandler, object.class.name, object.id, method, *args)
end
def self.queue
- 'backgrounded'
+ @@queue
end
-
def self.perform(clazz, id, method, *args)
clazz.constantize.find(id).send(method, *args)
end
end
end