This commit is contained in:
jxxghp
2025-06-26 08:18:37 +08:00
parent a487091be8
commit 2829a3cb4e
4 changed files with 2 additions and 14 deletions

View File

@@ -78,7 +78,3 @@ class SystemConfigOper(DbOper, metaclass=Singleton):
if conf:
conf.delete(self._db, conf.id)
return True
def __del__(self):
if self._db:
self._db.close()

View File

@@ -50,10 +50,6 @@ class UserConfigOper(DbOper, metaclass=Singleton):
return self.__get_config_caches(username=username)
return self.__get_config_cache(username=username, key=key)
def __del__(self):
if self._db:
self._db.close()
def __set_config_cache(self, username: str, key: str, value: Any):
"""
设置配置缓存

View File

@@ -1,8 +1,7 @@
from concurrent.futures import ThreadPoolExecutor
from typing import Optional
from app.utils.singleton import Singleton
from app.core.config import settings
from app.utils.singleton import Singleton
class ThreadHelper(metaclass=Singleton):
@@ -28,6 +27,3 @@ class ThreadHelper(metaclass=Singleton):
:return:
"""
self.pool.shutdown()
def __del__(self):
self.shutdown()

View File

@@ -31,7 +31,7 @@ class SingletonClass(abc.ABCMeta, type):
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(SingletonClass, cls).__call__(*args, **kwargs)
cls._instances[cls] = super().__call__(*args, **kwargs)
return cls._instances[cls]