Skip to content

Commit

Permalink
Delayed::Job can receive any kind of parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
blaxter committed May 3, 2010
1 parent 4cb874f commit 546143b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/delayed/worker.rb
Expand Up @@ -44,11 +44,12 @@ class Worker
# - job_types: constraint for selecting what jobs to execute (String or Array)
def initialize(options={})
[ :quiet, :name, :min_priority, :max_priority, :job_types, :only_for ].each do |attr_name|
send "#{attr_name}=", options[attr_name]
send "#{attr_name}=", options.delete(attr_name)
end
# Default values
self.name = DEFAULT_WORKER_NAME if self.name.nil?
self.quiet = true if self.quiet.nil?
@options = options
end

def start
Expand All @@ -61,7 +62,7 @@ def start
result = nil

realtime = Benchmark.realtime do
result = Job.work_off( constraints )
result = Job.work_off constraints.merge(@options)
end

count = result.sum
Expand Down

0 comments on commit 546143b

Please sign in to comment.