lib/backburner/worker.rb in backburner-0.1.2 vs lib/backburner/worker.rb in backburner-0.2.0

- old
+ new

@@ -22,11 +22,15 @@ def self.enqueue(job_class, args=[], opts={}) pri = opts[:pri] || job_class.queue_priority || Backburner.configuration.default_priority delay = [0, opts[:delay].to_i].max ttr = opts[:ttr] || Backburner.configuration.respond_timeout tube = connection.tubes[expand_tube_name(opts[:queue] || job_class)] + res = job_class.invoke_hook_events(:before_enqueue, *args) + return false unless res # stop if hook is false data = { :class => job_class.name, :args => args } tube.put data.to_json, :pri => pri, :delay => delay, :ttr => ttr + job_class.invoke_hook_events(:after_enqueue, *args) + return true end # Starts processing jobs in the specified tube_names # # @example \ No newline at end of file