删除多线程产图

This commit is contained in:
wzy-warehouse
2026-06-21 15:29:39 +08:00
parent 95a74d00f3
commit 7e59d1b3f5
4 changed files with 0 additions and 28 deletions
-17
View File
@@ -28,14 +28,6 @@ logger = get_logger("api.qgis")
router = APIRouter(prefix="/qgis", tags=["专题图导出"])
# 线程池(按配置初始化 worker 数量)
_worker_threads = getattr(settings, "QGIS_WORKER_THREADS", 4)
_thread_pool = concurrent.futures.ThreadPoolExecutor(
max_workers=_worker_threads,
thread_name_prefix="qgis-worker",
)
logger.info(f"QGIS 线程池初始化: {_worker_threads} workers")
# 去重锁
_in_progress_locks: dict[str, asyncio.Lock] = {}
_locks_lock = asyncio.Lock()
@@ -478,12 +470,3 @@ def _generate_maps_subprocess(chunk_models: list, config: dict, chunk_idx: int)
logger.warning(f"[子进程{chunk_idx}] 无输出")
return []
# ============================================================
# 清理函数
# ============================================================
def shutdown_thread_pool() -> None:
"""关闭线程池(在 server.py lifespan 关闭阶段调用)"""
_thread_pool.shutdown(wait=False)
logger.info("QGIS 线程池已关闭")