Further formatting fixes
This commit is contained in:
parent
6ce23bd9ca
commit
653af77e5f
|
@ -18,6 +18,9 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* Run the worker from a daemon.
|
* Run the worker from a daemon.
|
||||||
*
|
*
|
||||||
* This script was taken from http://php.net/manual/en/function.pcntl-fork.php
|
* This script was taken from http://php.net/manual/en/function.pcntl-fork.php
|
||||||
|
|
|
@ -77,11 +77,7 @@ class Cron
|
||||||
|
|
||||||
while ($entry = DBA::fetch($entries)) {
|
while ($entry = DBA::fetch($entries)) {
|
||||||
if (!posix_kill($entry["pid"], 0)) {
|
if (!posix_kill($entry["pid"], 0)) {
|
||||||
DBA::update(
|
DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'pid' => 0], ['id' => $entry["id"]]);
|
||||||
'workerqueue',
|
|
||||||
['executed' => DBA::NULL_DATETIME, 'pid' => 0],
|
|
||||||
['id' => $entry["id"]]
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// Kill long running processes
|
// Kill long running processes
|
||||||
|
|
||||||
|
@ -117,10 +113,7 @@ class Cron
|
||||||
} elseif ($entry['priority'] != PRIORITY_CRITICAL) {
|
} elseif ($entry['priority'] != PRIORITY_CRITICAL) {
|
||||||
$new_priority = PRIORITY_NEGLIGIBLE;
|
$new_priority = PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
DBA::update(
|
DBA::update('workerqueue', ['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0], ['id' => $entry["id"]]
|
||||||
'workerqueue',
|
|
||||||
['executed' => DBA::NULL_DATETIME, 'created' => DateTimeFormat::utcNow(), 'priority' => $new_priority, 'pid' => 0],
|
|
||||||
['id' => $entry["id"]]
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Process runtime is okay', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
|
Logger::info('Process runtime is okay', ['duration' => number_format($duration, 3), 'max' => $max_duration, 'id' => $entry["id"], 'pid' => $entry["pid"], 'command' => $command]);
|
||||||
|
@ -172,7 +165,7 @@ class Cron
|
||||||
$priority = PRIORITY_MEDIUM;
|
$priority = PRIORITY_MEDIUM;
|
||||||
} elseif ($delivery['failed'] < 8) {
|
} elseif ($delivery['failed'] < 8) {
|
||||||
$priority = PRIORITY_LOW;
|
$priority = PRIORITY_LOW;
|
||||||
} {
|
} else {
|
||||||
$priority = PRIORITY_NEGLIGIBLE;
|
$priority = PRIORITY_NEGLIGIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue