We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Result: Signal handler call after end work GearmanWorker::wait.
Expected Result: Signal dispatched whet GearmanWorker::wait work.
Run in cli (require php 7.1+, pcntl, pecl-gearman):
#!/usr/bin/env php <?php function debug($string, ...$args) { printf('%s: %s', date('Y-m-d H:i:s'),sprintf($string, ...$args)); echo PHP_EOL; } $quit = false; pcntl_async_signals(true); pcntl_alarm(1); pcntl_signal(SIGINT, function ($signo, $signinfo) use (&$quit) { $quit = true; debug('Signo: %s, Signinfo: %s', $signo, print_r($signinfo, 1)); }); pcntl_signal(SIGALRM, function ($signo, $signinfo) use (&$quit) { $quit = true; debug('Signo: %s, Signinfo: %s', $signo, print_r($signinfo, 1)); }); debug('SIGINT, SIGALRM inited'); $client = new \GearmanClient(); $client->addServer(); $worker = new \GearmanWorker(); $worker->addOptions(GEARMAN_WORKER_NON_BLOCKING); $worker->addServer(); $worker->setTimeout(5000); $worker->addFunction('test', function (\GearmanJob $arg) use ($client) { debug('Gearman worker do %s with %s', $arg->functionName(), $arg->workload()); return 1; }); debug('Start while worker'); while (!$quit) { $worker->work(); $returnCode = $worker->returnCode(); if ($returnCode === GEARMAN_NO_JOBS) { debug('Wait for jobs'); $worker->wait(); continue; } if ($returnCode === GEARMAN_IO_WAIT) { continue; } if ($returnCode !== GEARMAN_SUCCESS) { debug('return_code: %s', $returnCode); } } debug('Stop while worker');
If $worker->wait(); replace on sleep(10); then script stops almost instantly.
$worker->wait();
sleep(10);
The text was updated successfully, but these errors were encountered:
I found out that the problem is in the libgearman. gearman/gearmand#230
Sorry, something went wrong.
No branches or pull requests
Result:
Signal handler call after end work GearmanWorker::wait.
Expected Result:
Signal dispatched whet GearmanWorker::wait work.
Run in cli (require php 7.1+, pcntl, pecl-gearman):
If
$worker->wait();
replace onsleep(10);
then script stops almost instantly.The text was updated successfully, but these errors were encountered: