From 2d29d8631c6cb4ba41383003fb7ba84385eb7f1e Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Mon, 21 Oct 2024 10:04:31 +0800 Subject: [PATCH] fix: pool has already been opened/closed and cannot be reused --- cucyuqing/cmd/risk-analyze.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cucyuqing/cmd/risk-analyze.py b/cucyuqing/cmd/risk-analyze.py index e2b1e54..064a4cc 100644 --- a/cucyuqing/cmd/risk-analyze.py +++ b/cucyuqing/cmd/risk-analyze.py @@ -20,7 +20,7 @@ async def main(): await asyncio.sleep(60 * 30) except Exception as e: print(e) - await asyncio.sleep(60*60) + await asyncio.sleep(60 * 60) async def do_analyze(): @@ -60,15 +60,12 @@ async def do_analyze(): """, { "es_id": doc_id, - "risk_types": json.dumps(list(risks), ensure_ascii=False) if risks else None, + "risk_types": ( + json.dumps(list(risks), ensure_ascii=False) if risks else None + ), }, ) - await asyncio.gather( - pool.close(), - mysql.disconnect(), - ) - @dataclass class RiskType: