Don't always fork the poller.

This commit is contained in:
Michael 2017-06-05 06:08:26 +00:00
parent fb72fc77f5
commit 8db079c65e
4 changed files with 9 additions and 17 deletions

View file

@ -35,6 +35,7 @@ require_once 'include/features.php';
require_once 'include/identity.php';
require_once 'update.php';
require_once 'include/dbstructure.php';
require_once 'include/poller.php';
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus');
@ -1095,18 +1096,8 @@ function proc_run($cmd) {
return;
}
// Checking number of workers
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` > '%s'", dbesc(NULL_DATE));
// Get number of allowed number of worker threads
$queues = intval(get_config("system", "worker_queues"));
if ($queues == 0) {
$queues = 4;
}
// If there are already enough workers running, don't fork another one
if ($workers[0]["workers"] >= $queues) {
if (poller_too_much_workers()) {
return;
}