Add ability to prevent automatic scheduling for workers
[MAILPOET-1987]
This commit is contained in:
committed by
M. Shull
parent
cab9324f2c
commit
749e7c2dd5
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user