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