From 2652a0c3894aa6c4abcfc872f13e66bd4976eb7a Mon Sep 17 00:00:00 2001 From: skywalker Date: Mon, 30 Dec 2024 15:05:22 +0800 Subject: [PATCH] init mysql connection close --- scripts/setup-seafile-mysql.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/setup-seafile-mysql.py b/scripts/setup-seafile-mysql.py index 767a29cdd2..f1221fe5a5 100644 --- a/scripts/setup-seafile-mysql.py +++ b/scripts/setup-seafile-mysql.py @@ -470,7 +470,7 @@ Please choose a way to initialize seafile databases: print() raise InvalidAnswer('Failed to connect to mysql server at "%s:%s"' \ % (host, port)) - + dummy.close() print('done') def check_mysql_user(self, user, password, host=None, unix_socket=None): @@ -865,6 +865,7 @@ class CcnetConfigurator(AbstractConfigurator): Utils.error('Failed to init ccnet database: %s' % e) conn.commit() + conn.close() class SeafileConfigurator(AbstractConfigurator): @@ -990,6 +991,7 @@ class SeafileConfigurator(AbstractConfigurator): Utils.error('Failed to init seafile database: %s' % e) conn.commit() + conn.close() class SeahubConfigurator(AbstractConfigurator): def __init__(self): @@ -1131,6 +1133,7 @@ class SeahubConfigurator(AbstractConfigurator): Utils.error('Failed to init seahub database: %s' % e) conn.commit() + conn.close() def prepare_avatar_dir(self): # media_dir=${INSTALLPATH}/seahub/media @@ -1240,6 +1243,7 @@ class ProfessionalConfigurator(AbstractConfigurator): Utils.error('Failed to init seahub database: %s' % e) conn.commit() + conn.close() class GunicornConfigurator(AbstractConfigurator): def __init__(self): @@ -1559,6 +1563,8 @@ def main(): report_success() + db_config.root_conn.close() + def report_success(): message = '''\