-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hobson::Worker < Resque::Worker so i could set -bash to hobson rather…
… then resque
- Loading branch information
1 parent
08bb9be
commit b3c9f92
Showing
2 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class Hobson::Worker < Resque::Worker | ||
|
||
def initialize | ||
@parent_pid = $$ | ||
super '*' | ||
end | ||
|
||
def parent? | ||
$$ == @parent_pid | ||
end | ||
|
||
def child? | ||
!parent? | ||
end | ||
|
||
def proc_name | ||
parent? ? "hobson-#{Hobson.git_version}" : "hobson-worker:parent-#{@parent_pid}" | ||
end | ||
|
||
def procline(string) | ||
$0 = "#{proc_name}: #{string}" | ||
log! $0 | ||
end | ||
|
||
end |