mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 05:31:52 +00:00
fix(auto_scheduler): 优化调度性能,原本交错等待(Stagger)会阻塞其它群聊的启动
This commit is contained in:
@@ -457,11 +457,11 @@ class AutoScheduler:
|
||||
sem = asyncio.Semaphore(max_concurrent)
|
||||
|
||||
async def staggered_incremental(idx, gid, pid):
|
||||
async with sem:
|
||||
# 按索引交错延迟,均匀分散 API 压力
|
||||
if idx > 0 and stagger > 0:
|
||||
await asyncio.sleep(stagger * idx)
|
||||
# 按索引交错延迟,均匀分散 API 压力
|
||||
if idx > 0 and stagger > 0:
|
||||
await asyncio.sleep(stagger * idx)
|
||||
|
||||
async with sem:
|
||||
result = (
|
||||
await self._perform_incremental_analysis_for_group_with_timeout(
|
||||
gid, pid
|
||||
@@ -614,9 +614,10 @@ class AutoScheduler:
|
||||
sem = asyncio.Semaphore(max_concurrent)
|
||||
|
||||
async def staggered_final_report(idx, gid, pid):
|
||||
if idx > 0 and stagger > 0:
|
||||
await asyncio.sleep(stagger * idx)
|
||||
|
||||
async with sem:
|
||||
if idx > 0 and stagger > 0:
|
||||
await asyncio.sleep(stagger * idx)
|
||||
return await self._perform_incremental_final_report_for_group_with_timeout(
|
||||
gid, pid
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user