risk-analyze main 循环
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
from dataclasses import dataclass
|
||||
from os import system
|
||||
from typing import Iterable, Required
|
||||
from typing_extensions import Doc
|
||||
from typing import Iterable
|
||||
import openai
|
||||
import asyncio
|
||||
from openai.types.chat import ChatCompletionMessageParam
|
||||
@@ -16,6 +14,16 @@ from cucyuqing.dbscan import Document, run_dbscan
|
||||
|
||||
|
||||
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(
|
||||
pool.open(),
|
||||
mysql.connect(),
|
||||
@@ -54,6 +62,11 @@ async def main():
|
||||
},
|
||||
)
|
||||
|
||||
await asyncio.gather(
|
||||
pool.close(),
|
||||
mysql.disconnect(),
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class RiskType:
|
||||
|
||||
Reference in New Issue
Block a user