|
@@ -54,6 +54,8 @@ async def startup():
|
|
|
await retriever.initialize()
|
|
await retriever.initialize()
|
|
|
|
|
|
|
|
async def schedule_kb_sync():
|
|
async def schedule_kb_sync():
|
|
|
|
|
+ # 首次同步延迟 120s,让 healthcheck 先通过,避免 worker 刚启动就被阻塞
|
|
|
|
|
+ await asyncio.sleep(120)
|
|
|
while True:
|
|
while True:
|
|
|
try:
|
|
try:
|
|
|
from app.tasks.knowledge_sync import sync_knowledge_base
|
|
from app.tasks.knowledge_sync import sync_knowledge_base
|
|
@@ -63,7 +65,7 @@ async def startup():
|
|
|
await asyncio.sleep(3600)
|
|
await asyncio.sleep(3600)
|
|
|
|
|
|
|
|
asyncio.create_task(schedule_kb_sync())
|
|
asyncio.create_task(schedule_kb_sync())
|
|
|
- logger.info("知识库定时同步已启动 (间隔: 3600s)")
|
|
|
|
|
|
|
+ logger.info("知识库定时同步已启动 (首次延迟 120s,间隔 3600s)")
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.on_event("shutdown")
|
|
@app.on_event("shutdown")
|