mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-06 18:00:57 +00:00
fix: 修复数据库连接没有关闭问题 (#7227)
* fix: 修复数据库连接没有关闭的bug perf: websocket 断开也添加关闭数据库连接 * fix: 修复数据库连接没有关闭问题 Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -24,9 +24,9 @@ from copy import deepcopy
|
||||
|
||||
from common.const import LDAP_AD_ACCOUNT_DISABLE
|
||||
from common.utils import timeit, get_logger
|
||||
from common.db.utils import close_old_connections
|
||||
from users.utils import construct_user_email
|
||||
from users.models import User
|
||||
from orgs.models import Organization
|
||||
from authentication.backends.ldap import LDAPAuthorizationBackend, LDAPUser
|
||||
|
||||
logger = get_logger(__file__)
|
||||
@@ -331,15 +331,17 @@ class LDAPSyncUtil(object):
|
||||
|
||||
def perform_sync(self):
|
||||
logger.info('Start perform sync ldap users from server to cache')
|
||||
self.pre_sync()
|
||||
try:
|
||||
self.pre_sync()
|
||||
self.sync()
|
||||
self.post_sync()
|
||||
except Exception as e:
|
||||
error_msg = str(e)
|
||||
logger.error(error_msg)
|
||||
self.set_task_error_msg(error_msg)
|
||||
self.post_sync()
|
||||
logger.info('End perform sync ldap users from server to cache')
|
||||
finally:
|
||||
logger.info('End perform sync ldap users from server to cache')
|
||||
close_old_connections()
|
||||
|
||||
|
||||
class LDAPImportUtil(object):
|
||||
|
Reference in New Issue
Block a user