function poller_run($argv, $argc){
global $a, $db;
- if(is_null($a)) {
+ if (is_null($a)) {
$a = new App;
}
- if(is_null($db)) {
+ if (is_null($db)) {
@include(".htconfig.php");
require_once("include/dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
return;
}
- if(($argc <= 1) OR ($argv[1] != "no_cron")) {
+ if (($argc <= 1) OR ($argv[1] != "no_cron")) {
poller_run_cron();
}
return;
}
- foreach ($r AS $pid) {
+ foreach ($r AS $pid)
if (!posix_kill($pid["pid"], 0)) {
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d",
dbesc(NULL_DATE), intval($pid["pid"]));
// Kill long running processes
// Check if the priority is in a valid range
- if (!in_array($pid["priority"], array(PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE)))
+ if (!in_array($pid["priority"], array(PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE))) {
$pid["priority"] = PRIORITY_MEDIUM;
+ }
// Define the maximum durations
$max_duration_defaults = array(PRIORITY_CRITICAL => 360, PRIORITY_HIGH => 10, PRIORITY_MEDIUM => 60, PRIORITY_LOW => 180, PRIORITY_NEGLIGIBLE => 360);
// Decrease the number of workers at higher load
$load = current_load();
- if($load) {
+ if ($load) {
$maxsysload = intval(Config::get("system", "maxloadavg", 50));
$maxworkers = $queues;