Skip to content

Commit aed4d1f

Browse files
committed
Merge 'Hikariii/worker-process-name' into old-pulls
Closes chrisboulton/php-resque#337
2 parents fbc5c60 + 63ce150 commit aed4d1f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/Resque/Worker.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
*/
1212
class Resque_Worker
1313
{
14+
/**
15+
* @var string Prefix for the process name
16+
*/
17+
private static $processPrefix = 'resque';
18+
1419
/**
1520
* @var LoggerInterface Logging object that impliments the PSR-3 LoggerInterface
1621
*/
@@ -81,6 +86,15 @@ public function __construct($queues)
8186
$this->id = $this->hostname . ':'.getmypid() . ':' . implode(',', $this->queues);
8287
}
8388

89+
/**
90+
* Set the process prefix of the workers to the given prefix string.
91+
* @param string $prefix The new process prefix
92+
*/
93+
public static function setProcessPrefix($prefix)
94+
{
95+
self::$processPrefix = $prefix;
96+
}
97+
8498
/**
8599
* Return all workers known to Resque as instantiated instances.
86100
* @return array
@@ -376,7 +390,7 @@ private function startup()
376390
*/
377391
private function updateProcLine($status)
378392
{
379-
$processTitle = 'resque-' . Resque::VERSION . ': ' . $status;
393+
$processTitle = static::$processPrefix . '-' . Resque::VERSION . ': ' . $status;
380394
if(function_exists('cli_set_process_title') && PHP_OS !== 'Darwin') {
381395
cli_set_process_title($processTitle);
382396
}

0 commit comments

Comments
 (0)