hjr3 / pecl-gearman

PHP wrapper to libgearman
Other
46 stars 24 forks source link

GearmanWorker automatic recovery a fail server bug #13

Open breath-co2 opened 8 years ago

breath-co2 commented 8 years ago

code:

$gmWorker = new GearmanWorker();
$gmWorker->setId("myid");
$gmWorker->addServers('192.168.1.2,192.168.1.3');
$gmWorker->addFunction('test', function() {
//...
});
while (@$gmWorker->work()) {
    if ($gmWorker->returnCode() !== GEARMAN_SUCCESS) {
        break;
    }
}

bugs:

  1. when I stop and start 192.168.1.2's gearmand server, I found in 192.168.1.2 don't have any worker.
  2. Then next if I restart 192.168.1.3's gearmand server, 192.168.1.2 have found the test worker, but lost "myid", and 192.168.1.3 don't have any worker.