mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-15 09:12:18 +00:00
test(router): hold the concurrent upsert where its build reads the list back (#51878)
Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a1ea22e996
commit
4e97503afa
1 changed files with 7 additions and 3 deletions
|
|
@ -32,6 +32,12 @@ _CHURN_UPSERTS: Final = 120
|
|||
_UNREPORTED_MODEL_ID: Final = frozenset({"aresponses-stream", "aanthropic-messages"})
|
||||
_LIST_REFRESH: Final = HostedModelList.refresh.__code__
|
||||
_HAND_CHANGES: Final = HostRegistry._hand_changes.__code__
|
||||
_REREADS_AFTER_A_WRITE: Final = frozenset(
|
||||
{
|
||||
(_LIST_REFRESH, _HAND_CHANGES),
|
||||
(HostedModelList.end_build.__code__, HostRegistry._run_build.__code__),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def _router_source_files() -> frozenset[str]:
|
||||
|
|
@ -104,9 +110,7 @@ def _read_during_held_write(read: Callable[[], T], write: Callable[[], object])
|
|||
|
||||
def hold_at_reindex(frame: FrameType, event: str, _arg: object) -> None:
|
||||
caller: Final = frame.f_back
|
||||
refreshes_after_a_write: Final = (
|
||||
frame.f_code is _LIST_REFRESH and caller is not None and caller.f_code is _HAND_CHANGES
|
||||
)
|
||||
refreshes_after_a_write: Final = caller is not None and (frame.f_code, caller.f_code) in _REREADS_AFTER_A_WRITE
|
||||
if event == "call" and refreshes_after_a_write and not held.is_set():
|
||||
held.set()
|
||||
released_in_time.append(release.wait(timeout=_SYNC_SECONDS))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue