mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix: type-narrow session_id in _terminate_and_mark (mypy)
Defensive: if both `session_id` and `id` are missing, return early. The str-cast keeps mypy happy when the row uses a UUID-typed column. LIT-2878
This commit is contained in:
parent
2dc9b255f2
commit
b25dd8b716
1 changed files with 5 additions and 1 deletions
|
|
@ -101,7 +101,11 @@ async def _terminate_and_mark(
|
|||
prisma_client: Any,
|
||||
) -> None:
|
||||
"""Common path: terminate VM, update session row. Idempotent."""
|
||||
session_id = getattr(session, "session_id", None) or getattr(session, "id", None)
|
||||
session_id_raw = getattr(session, "session_id", None) or getattr(session, "id", None)
|
||||
if not session_id_raw:
|
||||
# Defensive: row without an id cannot be updated.
|
||||
return
|
||||
session_id: str = str(session_id_raw)
|
||||
|
||||
# Re-fetch the row to confirm status hasn't moved (cheap optimistic lock).
|
||||
fresh = None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue