修复在线问题
This commit is contained in:
@@ -164,10 +164,9 @@ class MultiplayerHub(Hub[MultiplayerClientState]):
|
||||
async def _clean_state(self, state: MultiplayerClientState):
|
||||
user_id = int(state.connection_id)
|
||||
|
||||
# Remove from online user tracking
|
||||
from app.router.v2.stats import remove_online_user
|
||||
|
||||
asyncio.create_task(remove_online_user(user_id))
|
||||
# Use centralized offline status management
|
||||
from app.service.online_status_manager import online_status_manager
|
||||
await online_status_manager.set_user_offline(user_id)
|
||||
|
||||
if state.room_id != 0 and state.room_id in self.rooms:
|
||||
server_room = self.rooms[state.room_id]
|
||||
@@ -182,10 +181,9 @@ class MultiplayerHub(Hub[MultiplayerClientState]):
|
||||
"""Track online users when connecting to multiplayer hub"""
|
||||
logger.info(f"[MultiplayerHub] Client {client.user_id} connected")
|
||||
|
||||
# Track online user
|
||||
from app.router.v2.stats import add_online_user
|
||||
|
||||
asyncio.create_task(add_online_user(client.user_id))
|
||||
# Use centralized online status management
|
||||
from app.service.online_status_manager import online_status_manager
|
||||
await online_status_manager.set_user_online(client.user_id, "multiplayer")
|
||||
|
||||
def _ensure_in_room(self, client: Client) -> ServerMultiplayerRoom:
|
||||
store = self.get_or_create_state(client)
|
||||
|
||||
Reference in New Issue
Block a user