fix: pool has already been opened/closed and cannot be reused

This commit is contained in:
2024-10-21 10:04:31 +08:00
parent 3dc47712e4
commit 2d29d8631c

View File

@@ -20,7 +20,7 @@ async def main():
await asyncio.sleep(60 * 30) await asyncio.sleep(60 * 30)
except Exception as e: except Exception as e:
print(e) print(e)
await asyncio.sleep(60*60) await asyncio.sleep(60 * 60)
async def do_analyze(): async def do_analyze():
@@ -60,15 +60,12 @@ async def do_analyze():
""", """,
{ {
"es_id": doc_id, "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 @dataclass
class RiskType: class RiskType: