Sha256: ee8e98557fd5a97156ddbcfba6f0641858df30c85d51a51185bfd8da03267759
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
module MultiWorker module Adapters class Resque def self.configure(base, opts={}) base.class_eval do @queue = opts[:queue] if @retry = opts[:retry] require "resque-retry" extend ::Resque::Plugins::Retry @retry_limit = @retry[:limit] @retry_delay = @retry[:delay] end if @lock = opts[:lock] require "resque-lock-timeout" extend ::Resque::Plugins::LockTimeout if @lock.is_a?(Hash) && @lock[:timeout] @lock_timeout = @lock[:timeout].to_i end if opts[:unique] @loner = true end elsif opts[:unique] require "resque-loner" include ::Resque::Plugins::UniqueJob end if opts[:status] require "resque-status" include ::Resque::Plugins::Status end def self.perform(*args) self.new.perform(*args) end def self.perform_async(*args) ::Resque.enqueue(self, *args) end def perform_async(*args) self.class.perform_async(*args) end end end def self.rake_task require 'rake' require 'resque/tasks' ::Rake::Task['resque:work'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
multi_worker-0.2.0 | lib/multi_worker/adapters/resque.rb |
multi_worker-0.1.0 | lib/multi_worker/adapters/resque.rb |