MCPcopy Create free account
hub / github.com/Loping151/RoverSign / _flush_activity_buffer

Function _flush_activity_buffer

RoverSign/__init__.py:31–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29 _FLUSH_INTERVAL = 60
30
31 async def _flush_activity_buffer():
32 if _activity_buffer:
33 pending = dict(_activity_buffer)
34 _activity_buffer.clear()
35 for key, (user_id, bot_id, bot_self_id) in pending.items():
36 try:
37 await RoverUserActivity.update_user_activity(user_id, bot_id, bot_self_id)
38 except Exception as e:
39 logger.warning(f"[库洛签到·插件] 批量活跃度写入失败: {e}")
40
41 if _group_activity_buffer:
42 group_pending = dict(_group_activity_buffer)
43 _group_activity_buffer.clear()
44 for key, (group_id, bot_id, bot_self_id) in group_pending.items():
45 try:
46 await RoverGroupActivity.update_group_activity(group_id, bot_id, bot_self_id)
47 except Exception as e:
48 logger.warning(f"[库洛签到·插件] 批量群活跃度写入失败: {e}")
49
50 _shutdown_event = asyncio.Event()
51

Callers 2

_activity_flush_loopFunction · 0.85
_flush_on_shutdownFunction · 0.85

Calls 2

update_user_activityMethod · 0.80
update_group_activityMethod · 0.80

Tested by

no test coverage detected