mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
fix issue 895 (scheduler creates zombies)
fix bug in windows : tasks did not start cleanup
This commit is contained in:

committed by
Romain Neutron

parent
eb73d9b907
commit
bfc1ddcb5f
@@ -143,7 +143,7 @@ class module_console_taskrun extends Command
|
|||||||
|
|
||||||
if (time() - $start > 0) {
|
if (time() - $start > 0) {
|
||||||
if ($this->shedulerPID) {
|
if ($this->shedulerPID) {
|
||||||
if ( ! posix_kill($this->shedulerPID, 0)) {
|
if (function_exists('posix_kill') && !posix_kill($this->shedulerPID, 0)) {
|
||||||
if (method_exists($this->task, 'signal')) {
|
if (method_exists($this->task, 'signal')) {
|
||||||
$this->task->signal('SIGNAL_SCHEDULER_DIED');
|
$this->task->signal('SIGNAL_SCHEDULER_DIED');
|
||||||
} else {
|
} else {
|
||||||
|
@@ -54,6 +54,11 @@ class task_Scheduler
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
|
if (function_exists('pcntl_signal')) {
|
||||||
|
// avoid <defunct> php when a task ends
|
||||||
|
pcntl_signal(SIGCHLD, SIG_IGN);
|
||||||
|
}
|
||||||
|
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
$registry = $appbox->get_registry();
|
$registry = $appbox->get_registry();
|
||||||
|
|
||||||
|
@@ -334,7 +334,7 @@ abstract class task_abstract
|
|||||||
|
|
||||||
abstract public function help();
|
abstract public function help();
|
||||||
|
|
||||||
public function __construct($taskid, Logger $logger)
|
public function __construct($taskid, Logger $logger = NULL)
|
||||||
{
|
{
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
|
@@ -73,9 +73,9 @@ class task_manager
|
|||||||
|
|
||||||
$core = \bootstrap::getCore();
|
$core = \bootstrap::getCore();
|
||||||
|
|
||||||
if ( ! $logger) {
|
// if ( ! $logger) {
|
||||||
$logger = $core['monolog'];
|
// $logger = $core['monolog'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
$sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC";
|
$sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC";
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
@@ -113,9 +113,9 @@ class task_manager
|
|||||||
{
|
{
|
||||||
$core = \bootstrap::getCore();
|
$core = \bootstrap::getCore();
|
||||||
|
|
||||||
if ( ! $logger) {
|
// if ( ! $logger) {
|
||||||
$logger = $core['monolog'];
|
// $logger = $core['monolog'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
$tasks = $this->getTasks(false, $logger);
|
$tasks = $this->getTasks(false, $logger);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user