Fix StatusUpdate field annotation and is_online batch-call mismatch
- status_message: str | Field(...) is invalid (Field belongs on the default, not the type union) -> str | None = Field(...) - router called is_online(ids) with a list and treated the bool result as a collection (uid in online_ids would TypeError on the first real call) -> added is_online_batch() using MGET, one round trip, tested against a live Redis instance
This commit is contained in:
@@ -43,7 +43,7 @@ class PresenceResponse(BaseModel):
|
||||
|
||||
|
||||
class StatusUpdate(BaseModel):
|
||||
status_message: str | Field(default=None, max_length=_STATUS_MAX_LEN)
|
||||
status_message: str | None = Field(default=None, max_length=_STATUS_MAX_LEN)
|
||||
|
||||
@field_validator("status_message")
|
||||
@classmethod
|
||||
@@ -107,7 +107,7 @@ async def get_presence(
|
||||
)
|
||||
|
||||
# Check Redis for online status
|
||||
online_ids = await _presence_store.is_online(ids)
|
||||
online_ids = await _presence_store.is_online_batch(ids)
|
||||
|
||||
# Fetch DB records for last_seen_at and status_message
|
||||
result = await db.execute(
|
||||
|
||||
Reference in New Issue
Block a user