From 211be5bfc521285f83c9b85211721d7815fa5689 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 9 Feb 2016 23:28:33 +0100 Subject: [PATCH 1/2] Poller: The maximum number of connections can now be configured --- include/dfrn.php | 4 +++- include/poller.php | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/dfrn.php b/include/dfrn.php index c4999a08e..6fa47af05 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -1252,8 +1252,10 @@ class dfrn { // Update check for this field has to be done differently $datefields = array("name-date", "uri-date"); foreach ($datefields AS $field) - if (strtotime($contact[$field]) > strtotime($r[0][$field])) + if (strtotime($contact[$field]) > strtotime($r[0][$field])) { + logger("Difference for contact ".$contact["id"]." in field '".$field."'. Old value: '".$contact[$field]."', new value '".$r[0][$field]."'", LOGGER_DEBUG); $update = true; + } foreach ($fields AS $field => $data) if ($contact[$field] != $r[0][$field]) { diff --git a/include/poller.php b/include/poller.php index 712f6d578..03f030771 100644 --- a/include/poller.php +++ b/include/poller.php @@ -130,9 +130,14 @@ function poller_max_connections_reached() { if (!$r) return false; - $max = intval($r[0]["Value"]); - if ($max == 0) - return false; + // Fetch the max value from the config. This is needed when the system cannot detect the correct value by itself. + $max = get_config("system", "max_connections"); + + if ($max == 0) { + $max = intval($r[0]["Value"]); + if ($max == 0) + return false; + } $r = q("SHOW STATUS WHERE `variable_name` = 'Threads_connected'"); if (!$r) From 902820b30d90c3b0930256388219a7e2d9b8cea6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 10 Feb 2016 07:56:49 +0100 Subject: [PATCH 2/2] Added documentation --- doc/htconfig.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/htconfig.md b/doc/htconfig.md index 4764c287c..f9c92bfa0 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -34,6 +34,7 @@ line to your .htconfig.php: * like_no_comment (Boolean) - Don't update the "commented" value of an item when it is liked. * local_block (Boolean) - Used in conjunction with "block_public". * local_search (Boolean) - Blocks the search for not logged in users to prevent crawlers from blocking your system. +* max_connections - The poller process isn't started when 3/4 of the possible database connections are used. When the system can't detect the maximum numbers of connection then this value can be used. * max_contact_queue - Default value is 500. * max_batch_queue - Default value is 1000. * no_oembed (Boolean) - Don't use OEmbed to fetch more information about a link.