- Updates CONST values
This commit is contained in:
@ -13,7 +13,7 @@ class CronHelper {
|
||||
|
||||
static function createDaemon($token) {
|
||||
$daemon = array(
|
||||
'status' => Daemon::DAEMON_STATUS_STARTING,
|
||||
'status' => Daemon::STATUS_STARTING,
|
||||
'counter' => 0,
|
||||
'token' => $token
|
||||
);
|
||||
|
@ -12,10 +12,10 @@ class Daemon {
|
||||
public $daemon;
|
||||
public $data;
|
||||
public $refreshed_token;
|
||||
const DAEMON_STATUS_STOPPED = 'stopped';
|
||||
const DAEMON_STATUS_STOPPING = 'stopping';
|
||||
const DAEMON_STATUS_STARTED = 'started';
|
||||
const DAEMON_STATUS_STARTING = 'starting';
|
||||
const STATUS_STOPPED = 'stopped';
|
||||
const STATUS_STOPPING = 'stopping';
|
||||
const STATUS_STARTED = 'started';
|
||||
const STATUS_STARTING = 'starting';
|
||||
private $timer;
|
||||
|
||||
function __construct($data) {
|
||||
@ -59,8 +59,8 @@ class Daemon {
|
||||
}
|
||||
$daemon['counter']++;
|
||||
$this->abortIfStopped($daemon);
|
||||
if($daemon['status'] === self::DAEMON_STATUS_STARTING) {
|
||||
$daemon['status'] = self::DAEMON_STATUS_STARTED;
|
||||
if($daemon['status'] === self::STATUS_STARTING) {
|
||||
$daemon['status'] = self::STATUS_STARTED;
|
||||
}
|
||||
$daemon['token'] = $this->token;
|
||||
CronHelper::saveDaemon($daemon);
|
||||
@ -68,9 +68,9 @@ class Daemon {
|
||||
}
|
||||
|
||||
function abortIfStopped($daemon) {
|
||||
if($daemon['status'] === self::DAEMON_STATUS_STOPPED) exit;
|
||||
if($daemon['status'] === self::DAEMON_STATUS_STOPPING) {
|
||||
$daemon['status'] = self::DAEMON_STATUS_STOPPING;
|
||||
if($daemon['status'] === self::STATUS_STOPPED) exit;
|
||||
if($daemon['status'] === self::STATUS_STOPPING) {
|
||||
$daemon['status'] = self::STATUS_STOPPING;
|
||||
CronHelper::saveDaemon($daemon);
|
||||
exit;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class Supervisor {
|
||||
// if the daemon is stopped, return its status and do nothing
|
||||
if(!$this->force_run &&
|
||||
isset($daemon['status']) &&
|
||||
$daemon['status'] === Daemon::DAEMON_STATUS_STOPPED
|
||||
$daemon['status'] === Daemon::STATUS_STOPPED
|
||||
) {
|
||||
return $this->formatDaemonStatusMessage($daemon['status']);
|
||||
|
||||
@ -40,8 +40,8 @@ class Supervisor {
|
||||
elseif($elapsed_time < CronHelper::DAEMON_EXECUTION_TIMEOUT &&
|
||||
$this->force_run &&
|
||||
in_array($daemon['status'], array(
|
||||
Daemon::DAEMON_STATUS_STOPPING,
|
||||
Daemon::DAEMON_STATUS_STARTING
|
||||
Daemon::STATUS_STOPPING,
|
||||
Daemon::STATUS_STARTING
|
||||
))
|
||||
) {
|
||||
return $this->formatDaemonStatusMessage($daemon['status']);
|
||||
|
Reference in New Issue
Block a user