@@ -53,7 +53,7 @@ class Resque_Worker
53
53
* @var Resque_Job Current job, if any, being processed by this worker.
54
54
*/
55
55
private $ currentJob = null ;
56
-
56
+
57
57
/**
58
58
* @var int Process ID of child worker processes.
59
59
*/
@@ -95,7 +95,7 @@ public static function exists($workerId)
95
95
*/
96
96
public static function find ($ workerId )
97
97
{
98
- if (!self ::exists ($ workerId )) {
98
+ if (!self ::exists ($ workerId) || false === strpos ( $ workerId , " : " )) {
99
99
return false ;
100
100
}
101
101
@@ -447,12 +447,14 @@ public function pruneDeadWorkers()
447
447
$ workerPids = $ this ->workerPids ();
448
448
$ workers = self ::all ();
449
449
foreach ($ workers as $ worker ) {
450
- list ($ host , $ pid , $ queues ) = explode (': ' , (string )$ worker , 3 );
451
- if ($ host != $ this ->hostname || in_array ($ pid , $ workerPids ) || $ pid == getmypid ()) {
452
- continue ;
453
- }
454
- $ this ->log ('Pruning dead worker: ' . (string )$ worker , self ::LOG_VERBOSE );
455
- $ worker ->unregisterWorker ();
450
+ if (is_object ($ worker )) {
451
+ list ($ host , $ pid , $ queues ) = explode (': ' , (string )$ worker , 3 );
452
+ if ($ host != $ this ->hostname || in_array ($ pid , $ workerPids ) || $ pid == getmypid ()) {
453
+ continue ;
454
+ }
455
+ $ this ->log ('Pruning dead worker: ' . (string )$ worker , self ::LOG_VERBOSE );
456
+ $ worker ->unregisterWorker ();
457
+ }
456
458
}
457
459
}
458
460
0 commit comments