Skip to content

Commit

Permalink
updated delayed_job to be fork-able, and made it change the name of t…
Browse files Browse the repository at this point in the history
…he process to reflect its current task when busy
  • Loading branch information
Woody Peterson authored and Woody Peterson committed Jun 22, 2009
1 parent 266fc15 commit 7df707a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/delayed/job.rb
Expand Up @@ -214,7 +214,11 @@ def self.work_off(num = 100)

# Moved into its own method so that new_relic can trace it.
def invoke_job
base_name = $0
$0 = "#{base_name}: #{self.payload_object.to_s}"
payload_object.perform
ensure
$0 = base_name
end

private
Expand Down
2 changes: 2 additions & 0 deletions lib/delayed/worker.rb
Expand Up @@ -10,6 +10,8 @@ class Worker
end

def initialize(options={})
Delayed::Job.worker_name = "host:#{Socket.gethostname} pid:#{Process.pid}" rescue "pid:#{Process.pid}"

@quiet = options[:quiet]
Delayed::Job.min_priority = options[:min_priority] if options.has_key?(:min_priority)
Delayed::Job.max_priority = options[:max_priority] if options.has_key?(:max_priority)
Expand Down

0 comments on commit 7df707a

Please sign in to comment.