unset($db_host, $db_user, $db_pass, $db_data);
};
+ if ($a->max_processes_reached())
+ return;
+
if (poller_max_connections_reached())
return;
while ($r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `created` LIMIT 1")) {
+ // Constantly check the number of parallel database processes
+ if ($a->max_processes_reached())
+ return;
+
// Constantly check the number of available database connections to let the frontend be accessible at any time
if (poller_max_connections_reached())
return;
function poller_kill_stale_workers() {
$r = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'");
- if (!is_array($r) || count($r) == 0) {
+ if (!dbm::is_result($r)) {
// No processing here needed
return;
}