修复用户状态问题

This commit is contained in:
咕谷酱
2025-08-22 13:06:23 +08:00
parent 592d2e39ff
commit 6136b9fed3
8 changed files with 322 additions and 36 deletions

View File

@@ -134,10 +134,10 @@ class StatsScheduler:
"""清理循环 - 每10分钟清理一次过期用户"""
# 启动时立即执行一次清理
try:
online_cleaned, playing_cleaned = await cleanup_stale_online_users()
if online_cleaned > 0 or playing_cleaned > 0:
online_cleaned, playing_cleaned, metadata_cleaned = await cleanup_stale_online_users()
if online_cleaned > 0 or playing_cleaned > 0 or metadata_cleaned > 0:
logger.info(
f"Initial cleanup: removed {online_cleaned} stale online users, {playing_cleaned} stale playing users"
f"Initial cleanup: removed {online_cleaned} stale online users, {playing_cleaned} stale playing users, {metadata_cleaned} orphaned metadata keys"
)
await refresh_redis_key_expiry()
@@ -153,10 +153,10 @@ class StatsScheduler:
try:
# 清理过期用户
online_cleaned, playing_cleaned = await cleanup_stale_online_users()
if online_cleaned > 0 or playing_cleaned > 0:
online_cleaned, playing_cleaned, metadata_cleaned = await cleanup_stale_online_users()
if online_cleaned > 0 or playing_cleaned > 0 or metadata_cleaned > 0:
logger.info(
f"Cleanup: removed {online_cleaned} stale online users, {playing_cleaned} stale playing users"
f"Cleanup: removed {online_cleaned} stale online users, {playing_cleaned} stale playing users, {metadata_cleaned} orphaned metadata keys"
)
# 刷新Redis key过期时间