mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
Merge with 3.7
This commit is contained in:
@@ -35,6 +35,7 @@ class task_Scheduler
|
||||
|
||||
public function __construct(Application $application, Logger $logger)
|
||||
{
|
||||
declare(ticks = 1);
|
||||
$this->dependencyContainer = $application;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
@@ -50,6 +51,14 @@ class task_Scheduler
|
||||
* @throws Exception if scheduler is already running
|
||||
* @todo doc all possible exception
|
||||
*/
|
||||
public function sigHandler($signal)
|
||||
{
|
||||
$status = null;
|
||||
$pid = pcntl_wait($status);
|
||||
$exitstatus = pcntl_wexitstatus($status);
|
||||
$this->log(sprintf("sigchild %s received from pid=%s, status=%s, exitstatus=%s\n", $signal, $pid, var_export($status, true), $exitstatus));
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
//prevent scheduler to fail if GV_cli is not provided
|
||||
@@ -67,7 +76,10 @@ class task_Scheduler
|
||||
|
||||
if (\task_manager::isPosixPcntlSupported()) {
|
||||
// avoid <defunct> php when a task ends
|
||||
pcntl_signal(SIGCHLD, SIG_IGN);
|
||||
// pcntl_signal(SIGCHLD, SIG_IGN); // no zombies but no returnValue
|
||||
// pcntl_signal(SIGCHLD, SIG_DFL); // with "declare(ticks=1)" returnValue ok but zombies
|
||||
pcntl_signal(SIGCHLD, array($this, 'sigHandler')); // ok
|
||||
|
||||
$this->method = self::METHOD_FORK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user