litellm/enterprise/litellm_enterprise
devin-ai-integration[bot] b2aff8be0f
fix(proxy): claim batch cost rows atomically so multi-pod polling can't double-bill (#37685)
Every pod and uvicorn worker schedules its own CheckBatchCost poller against the
shared managed-object table, so two of them can select the same completed batch in
one polling window and both write an aretrieve_batch spend log for it, counting
that batch's cost twice.

Claim the row with a compare-and-swap on batch_processed, and skip the batch when
another pod already holds it. The claim sits immediately before the spend log is
written rather than before the results fetch, because batch_processed is also what
blocks deletion of the files the fetch reads and what keeps an unbilled row
selectable by later poll cycles, so claiming up front would strand the spend of any
worker that died mid-fetch. A failed spend log write hands the row back.

Co-authored-by: Yassin Kortam <yassin@berri.ai>
2026-08-20 16:21:04 -07:00
..
enterprise_callbacks fix(email): stop duplicate legacy invitation email and fix its onboarding link (#36455) 2026-08-10 23:26:27 -07:00
integrations fix(lint): bring basedpyright rule counts back under their budget limits 2026-08-05 10:23:02 -07:00
litellm_core_utils fix(lint): bring basedpyright rule counts back under their budget limits 2026-08-05 10:23:02 -07:00
proxy fix(proxy): claim batch cost rows atomically so multi-pod polling can't double-bill (#37685) 2026-08-20 16:21:04 -07:00
types fix(lint): bring basedpyright rule counts back under their budget limits 2026-08-05 10:23:02 -07:00
__init__.py [Refactor] Use pip package for enterprise/ folder (#10709) 2025-05-09 17:18:48 -07:00
py.typed fix(lint): bring basedpyright rule counts back under their budget limits 2026-08-05 10:23:02 -07:00