From 59325c0773e2749713a922c320149d9e77fdd8af Mon Sep 17 00:00:00 2001
From: Paul Mehrer
Date: Thu, 26 Sep 2024 18:10:32 +0200
Subject: [PATCH] tweak(TB User LdapAd) tweak backend retry behavior
---
tine20/Tinebase/User.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tine20/Tinebase/User.php b/tine20/Tinebase/User.php
index 3c131feed1..26ee2ef333 100644
--- a/tine20/Tinebase/User.php
+++ b/tine20/Tinebase/User.php
@@ -252,7 +252,7 @@ public static function factory($backendType)
if ((self::ACTIVEDIRECTORY === $backendType || self::LDAP === $backendType)
&& Tinebase_Config::getInstance()->{Tinebase_Config::USERBACKEND}->{Tinebase_Config::SYNCOPTIONS}->{Tinebase_Config::SYNC_USER_OF_GROUPS}
&& ($unavailableSince = Tinebase_Config::getInstance()->USERBACKEND_UNAVAILABLE_SINCE)) {
- if (time() - $unavailableSince < 60) {
+ if (time() - $unavailableSince < 60 * 15) {
$backendType = self::SQL;
}
}
@@ -289,7 +289,10 @@ public static function factory($backendType)
}
} catch (Tinebase_Exception_Backend_Ldap $e) {
if (Tinebase_Config::getInstance()->{Tinebase_Config::USERBACKEND}->{Tinebase_Config::SYNCOPTIONS}->{Tinebase_Config::SYNC_USER_OF_GROUPS}) {
- Tinebase_Config::getInstance()->USERBACKEND_UNAVAILABLE_SINCE = time();
+ Tinebase_Config::getInstance()->clearCache();
+ try {
+ Tinebase_Config::getInstance()->USERBACKEND_UNAVAILABLE_SINCE = time();
+ } catch (Exception) {}
return self::factory(self::SQL);
} else {
throw $e;