()
| 50 | _shutdown_event = asyncio.Event() |
| 51 | |
| 52 | async def _activity_flush_loop(): |
| 53 | while not _shutdown_event.is_set(): |
| 54 | try: |
| 55 | await asyncio.wait_for(_shutdown_event.wait(), timeout=_FLUSH_INTERVAL) |
| 56 | break # shutdown signaled |
| 57 | except asyncio.TimeoutError: |
| 58 | pass |
| 59 | try: |
| 60 | await _flush_activity_buffer() |
| 61 | except Exception as e: |
| 62 | logger.warning(f"[库洛签到·插件] 活跃度刷写循环异常: {e}") |
| 63 | |
| 64 | _flush_task = asyncio.get_event_loop().create_task(_activity_flush_loop()) |
| 65 |
no test coverage detected