Add ability to prevent automatic scheduling for workers

[MAILPOET-1987]
This commit is contained in:
Rostislav Wolny
2019-05-10 10:14:20 +02:00
committed by M. Shull
parent cab9324f2c
commit 749e7c2dd5

View File

@@ -14,6 +14,7 @@ abstract class SimpleWorker {
private $wp; private $wp;
const TASK_TYPE = null; const TASK_TYPE = null;
const TASK_BATCH_SIZE = 5; const TASK_BATCH_SIZE = 5;
const AUTOMATIC_SCHEDULING = true;
function __construct($timer = false) { function __construct($timer = false) {
if (static::TASK_TYPE === null) { if (static::TASK_TYPE === null) {
@@ -43,7 +44,9 @@ abstract class SimpleWorker {
$running_tasks = self::getRunningTasks(); $running_tasks = self::getRunningTasks();
if (!$scheduled_tasks && !$running_tasks) { if (!$scheduled_tasks && !$running_tasks) {
self::schedule(); if (static::AUTOMATIC_SCHEDULING) {
self::schedule();
}
return false; return false;
} }