This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, 6.1 has been updated
via 2a8b3abcc86607843a2e7bc178e9fecfb5f4a7f7 (commit)
from aeba31541ac687e8437aeba2eef7cb0b5e1424a2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2a8b3abcc86607843a2e7bc178e9fecfb5f4a7f7
commit 2a8b3abcc86607843a2e7bc178e9fecfb5f4a7f7
Author: Roland Mas <[email protected]>
Date: Thu Apr 2 20:59:42 2020 +0200
improve systasksd's resilience to database connection being down
diff --git a/src/bin/systasksd b/src/bin/systasksd
index 360bcdb..7e8bb4c 100755
--- a/src/bin/systasksd
+++ b/src/bin/systasksd
@@ -36,10 +36,22 @@ while (true) {
}
require_once $gfcommon.'include/cron_utils.php';
+function reconnect_db_if_needed() {
+ $res = db_query_params("SELECT 1");
+ if (!$res && !db_connection_status()) {
+ db_reconnect();
+ return 0;
+ }
+ return 1;
+}
+
// Invalidate users/groups cache e.g. when a user is added to a group
// Special-case in 'publish-subscribe' mode
function usergroups_sync() {
global $usergroups_lastsync;
+ if (reconnect_db_if_needed() == 0) {
+ return;
+ }
$res = db_query_params("SELECT MAX(last_modified_date) AS lastmodified
FROM nss_usergroups");
$row = db_fetch_array($res);
if ($row['lastmodified'] >= $usergroups_lastsync) {
@@ -121,11 +133,13 @@ $pm = plugin_manager_get_object();
usergroups_sync();
while (true) {
+ sleep(1);
+ if (reconnect_db_if_needed() == 0) {
+ continue;
+ }
// Deal with pending requests
$res = db_query_params("SELECT * FROM systasks WHERE status=$1"
. " ORDER BY systask_id",
array('TODO'));
- if (!$res && !db_connection_status())
- db_reconnect();
while ($arr = db_fetch_array($res)) {
$script = systask_get_script($arr['plugin_id'],
$arr['systask_type']);
if (!file_exists($script))
-----------------------------------------------------------------------
Summary of changes:
src/bin/systasksd | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits