mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-05-11 18:11:05 +08:00
feat: 引入异步文件 I/O 避免阻塞事件循环,共享全局 httpx 连接池
This commit is contained in:
8
entry.py
8
entry.py
@@ -5,7 +5,7 @@ import uvloop
|
||||
from loguru import logger
|
||||
|
||||
from models import init_model
|
||||
from processor import process
|
||||
from processor import cleanup, process
|
||||
from settings import settings
|
||||
|
||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||
@@ -25,4 +25,8 @@ async def entry() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(entry())
|
||||
with asyncio.Runner() as runner:
|
||||
try:
|
||||
runner.run(entry())
|
||||
finally:
|
||||
runner.run(cleanup())
|
||||
|
||||
Reference in New Issue
Block a user