- Adds new task scheduler configuration class

- Introduces method to start cron on demand when there are
  scheduled newsletters or queues in progress
This commit is contained in:
Vlad
2016-07-19 08:48:49 -04:00
parent ca2c1c2e6f
commit 6dd3c6acda
4 changed files with 84 additions and 13 deletions

View File

@@ -107,7 +107,7 @@ class Initializer {
$this->setupShortcodes();
$this->setupHooks();
$this->setupImages();
$this->runQueueSupervisor();
$this->setupTaskScheduler();
$this->plugin_initialized = true;
} catch(\Exception $e) {
@@ -192,14 +192,9 @@ class Initializer {
$router->init();
}
function runQueueSupervisor() {
if(php_sapi_name() === 'cli') return;
try {
$supervisor = new Supervisor();
$supervisor->checkDaemon();
} catch(\Exception $e) {
// Prevent Daemon exceptions from breaking out and breaking UI
}
function setupTaskScheduler() {
$task_scheduler = new TaskScheduler();
$task_scheduler->init();
}
function setupImages() {