]> git.mxchange.org Git - friendica.git/commitdiff
Added the new function to the poller.
authorMichael Vogel <icarus@dabo.de>
Sat, 2 Jul 2016 07:31:28 +0000 (09:31 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 2 Jul 2016 07:31:28 +0000 (09:31 +0200)
include/dba.php
include/poller.php
index.php

index cae045d874cb384e5d4dac8176175a30acdaac90..6ce095fc65ea10908e4155fac2d778392492beb1 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+require_once("dbm.php");
 
 # if PDO is avaible for mysql, use the new database abstraction
 # TODO: PDO is disabled for release 3.3. We need to investigate why
index a391ea8c7528f654bd944ca1328ca7e01d86fb5b..2eca03ef98e346b9aa238a09ca13ef24f44b9015 100644 (file)
@@ -11,7 +11,6 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
 }
 
 require_once("boot.php");
-require_once("dbm.php");
 
 function poller_run(&$argv, &$argc){
        global $a, $db;
@@ -27,19 +26,8 @@ function poller_run(&$argv, &$argc){
                unset($db_host, $db_user, $db_pass, $db_data);
        };
 
-       $max_processes = get_config('system', 'max_processes_backend');
-       if (intval($max_processes) == 0)
-               $max_processes = 5;
-
-       $processlist = dbm::processlist();
-       if ($processlist["list"] != "") {
-               logger("Processcheck: Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
-
-               if ($processlist["amount"] > $max_processes) {
-                       logger("Processcheck: Maximum number of processes for backend tasks (".$max_processes.") reached.", LOGGER_DEBUG);
-                       return;
-               }
-       }
+       if ($a->max_processes_reached())
+               return;
 
        if (poller_max_connections_reached())
                return;
@@ -74,16 +62,9 @@ function poller_run(&$argv, &$argc){
 
        while ($r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `created` LIMIT 1")) {
 
-               // Log the type of database processes
-               $processlist = dbm::processlist();
-               if ($processlist["amount"] != "") {
-                       logger("Processcheck: Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
-
-                       if ($processlist["amount"] > $max_processes) {
-                               logger("Processcheck: Maximum number of processes for backend tasks (".$max_processes.") reached.", LOGGER_DEBUG);
-                               return;
-                       }
-               }
+               // 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())
index d2d3ecec3a371f4fa173627431678d1279bde392..cde267cd19f3db07fa5160f9bccf84b668b384aa 100644 (file)
--- a/index.php
+++ b/index.php
@@ -45,7 +45,6 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
  */
 
 require_once("include/dba.php");
-require_once("include/dbm.php");
 
 if(!$install) {
        $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);