public function testDeadWorkerCleanUpDoesNotCleanUnknownWorkers() { // Register a bad worker on this machine $worker = new Resque_Worker('jobs'); $worker->setLogger(new Resque_Log()); $workerId = explode(':', $worker); $worker->setId($workerId[0] . ':1:jobs'); $worker->registerWorker(); // Register some other false workers $worker = new Resque_Worker('jobs'); $worker->setLogger(new Resque_Log()); $worker->setId('my.other.host:1:jobs'); $worker->registerWorker(); $this->assertEquals(2, count(Resque_Worker::all())); $worker->pruneDeadWorkers(); // my.other.host should be left $workers = Resque_Worker::all(); $this->assertEquals(1, count($workers)); $this->assertEquals((string) $worker, (string) $workers[0]); }
/** * Remove a worker * @param string $id tring identifying this worker * @return bool */ public function removeWorker($id) { $worker = new \Resque_Worker('*'); $worker->setId($id); return $worker->unregisterWorker(); }