Fixed code structure
This commit is contained in:
parent
dc16e6d471
commit
6ce23bd9ca
|
@ -68,7 +68,6 @@ class Cron
|
||||||
*/
|
*/
|
||||||
public static function killStaleWorkers()
|
public static function killStaleWorkers()
|
||||||
{
|
{
|
||||||
$stamp = (float)microtime(true);
|
|
||||||
$entries = DBA::select(
|
$entries = DBA::select(
|
||||||
'workerqueue',
|
'workerqueue',
|
||||||
['id', 'pid', 'executed', 'priority', 'command', 'parameter'],
|
['id', 'pid', 'executed', 'priority', 'command', 'parameter'],
|
||||||
|
@ -78,7 +77,6 @@ class Cron
|
||||||
|
|
||||||
while ($entry = DBA::fetch($entries)) {
|
while ($entry = DBA::fetch($entries)) {
|
||||||
if (!posix_kill($entry["pid"], 0)) {
|
if (!posix_kill($entry["pid"], 0)) {
|
||||||
$stamp = (float)microtime(true);
|
|
||||||
DBA::update(
|
DBA::update(
|
||||||
'workerqueue',
|
'workerqueue',
|
||||||
['executed' => DBA::NULL_DATETIME, 'pid' => 0],
|
['executed' => DBA::NULL_DATETIME, 'pid' => 0],
|
||||||
|
@ -119,7 +117,6 @@ class Cron
|
||||||
} elseif ($entry['priority'] != PRIORITY_CRITICAL) {
|
} elseif ($entry['priority'] != PRIORITY_CRITICAL) {
|
||||||
$new_priority = PRIORITY_NEGLIGIBLE;
|
$new_priority = PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
$stamp = (float)microtime(true);
|
|
||||||
DBA::update(
|
DBA::update(
|
||||||
'workerqueue',
|
'workerqueue',
|
||||||
['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
|
['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
|
||||||
|
|
|
@ -129,9 +129,7 @@ class Daemon
|
||||||
private static function spawn()
|
private static function spawn()
|
||||||
{
|
{
|
||||||
Logger::notice('Starting new daemon process');
|
Logger::notice('Starting new daemon process');
|
||||||
$command = 'bin/daemon.php';
|
DI::system()->run('bin/daemon.php', ['start']);
|
||||||
$a = DI::app();
|
|
||||||
DI::system()->run($command, ['start']);
|
|
||||||
Logger::notice('New daemon process started');
|
Logger::notice('New daemon process started');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ class IPC
|
||||||
*/
|
*/
|
||||||
public static function JobsExists(int $key = 0)
|
public static function JobsExists(int $key = 0)
|
||||||
{
|
{
|
||||||
$stamp = (float)microtime(true);
|
|
||||||
$row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => $key]);
|
$row = DBA::selectFirst('worker-ipc', ['jobs'], ['key' => $key]);
|
||||||
|
|
||||||
// When we don't have a row, no job is running
|
// When we don't have a row, no job is running
|
||||||
|
|
Loading…
Reference in New Issue
Block a user