From a395634c0deeec6b1acec2f69cb50d08e52c6fd7 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 16 Mar 2017 10:40:04 +0000 Subject: [PATCH] Try restarting the LDAP connection when an exception happened Signed-off-by: Michael Tremer --- webapp/backend/accounts.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/webapp/backend/accounts.py b/webapp/backend/accounts.py index 242cbf38..eb30e2b3 100644 --- a/webapp/backend/accounts.py +++ b/webapp/backend/accounts.py @@ -30,8 +30,15 @@ class Accounts(Object): logging.debug("Performing LDAP query: %s" % query) search_base = self.settings.get("ldap_search_base") - results = self.ldap.search_ext_s(search_base, ldap.SCOPE_SUBTREE, - query, attrlist=attrlist, sizelimit=limit) + + try: + results = self.ldap.search_ext_s(search_base, ldap.SCOPE_SUBTREE, + query, attrlist=attrlist, sizelimit=limit) + except: + # Close current connection + del self._ldap + + raise return results -- 2.47.3