refactor: reorganize backend module boundaries

This commit is contained in:
jxxghp
2026-08-14 19:53:33 +08:00
parent fe0b444ceb
commit 369d7d6448
584 changed files with 2423 additions and 2275 deletions
+30
View File
@@ -0,0 +1,30 @@
from concurrent.futures import ThreadPoolExecutor
from app.runtime.config import settings
from app.foundation.singleton import Singleton
class ThreadHelper(metaclass=Singleton):
"""
线程池管理
"""
def __init__(self):
"""按系统配置创建共享后台线程池。"""
self.pool = ThreadPoolExecutor(max_workers=settings.CONF.threadpool)
def submit(self, func, *args, **kwargs):
"""
提交任务
:param func: 函数
:param args: 参数
:param kwargs: 参数
:return: future
"""
return self.pool.submit(func, *args, **kwargs)
def shutdown(self):
"""
关闭线程池
:return:
"""
self.pool.shutdown()