- Modifies cron router/UI to display proper status message when WP task

scheduler is configured and cron is not running
- Updates sending queue worker and related components to stop (delete)
  cron when all processing is done
This commit is contained in:
Vlad
2016-07-19 09:02:58 -04:00
parent 5ed0a5819c
commit a438f13bb0
6 changed files with 65 additions and 13 deletions

View File

@ -12,6 +12,7 @@ class CronHelper {
const DAEMON_EXECUTION_LIMIT = 20;
const DAEMON_EXECUTION_TIMEOUT = 35;
const DAEMON_REQUEST_TIMEOUT = 2;
const DAEMON_SETTING = 'cron_daemon';
static function createDaemon($token) {
$daemon = array(
@ -23,17 +24,27 @@ class CronHelper {
}
static function getDaemon() {
return Setting::getValue('cron_daemon');
return Setting::getValue(self::DAEMON_SETTING);
}
static function saveDaemon($daemon) {
$daemon['updated_at'] = time();
return Setting::setValue(
'cron_daemon',
self::DAEMON_SETTING,
$daemon
);
}
static function stopDaemon() {
$daemon = self::getDaemon();
$daemon['status'] = Daemon::STATUS_STOPPED;
return self::saveDaemon($daemon);
}
static function deleteDaemon() {
return Setting::deleteSetting(self::DAEMON_SETTING);
}
static function createToken() {
return Security::generateRandomString();
}