risk-analyze main 循环

This commit is contained in:
2024-10-18 16:59:43 +08:00
parent 3d36dcadf6
commit cae3877048

View File

@@ -1,7 +1,5 @@
from dataclasses import dataclass from dataclasses import dataclass
from os import system from typing import Iterable
from typing import Iterable, Required
from typing_extensions import Doc
import openai import openai
import asyncio import asyncio
from openai.types.chat import ChatCompletionMessageParam from openai.types.chat import ChatCompletionMessageParam
@@ -16,6 +14,16 @@ from cucyuqing.dbscan import Document, run_dbscan
async def main(): async def main():
while True:
try:
await do_analyze()
await asyncio.sleep(60 * 30)
except Exception as e:
print(e)
await asyncio.sleep(60*60)
async def do_analyze():
await asyncio.gather( await asyncio.gather(
pool.open(), pool.open(),
mysql.connect(), mysql.connect(),
@@ -54,6 +62,11 @@ async def main():
}, },
) )
await asyncio.gather(
pool.close(),
mysql.disconnect(),
)
@dataclass @dataclass
class RiskType: class RiskType: