整理代码
This commit is contained in:
@@ -92,11 +92,12 @@ class MetadataHub(Hub[MetadataClientState]):
|
||||
@override
|
||||
async def _clean_state(self, state: MetadataClientState) -> None:
|
||||
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))
|
||||
|
||||
|
||||
if state.pushable:
|
||||
await asyncio.gather(*self.broadcast_tasks(user_id, None))
|
||||
redis = get_redis()
|
||||
@@ -125,6 +126,7 @@ class MetadataHub(Hub[MetadataClientState]):
|
||||
|
||||
# Track online user
|
||||
from app.router.v2.stats import add_online_user
|
||||
|
||||
asyncio.create_task(add_online_user(user_id))
|
||||
|
||||
async with with_db() as session:
|
||||
|
||||
Reference in New Issue
Block a user