mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
test(integration): recognize the model list's lock in the held write helper (#50974)
The registry lock fix (#50933) makes add_deployment and set_model_list wait for a held delete on the same lock, taken inside HostedModelList as self._lock. The helper only knew lines spelled with self._deployment_index_lock, so it never saw those two writes reach the lock and timed out after 10 seconds.
This commit is contained in:
parent
2624f7caea
commit
906578df39
1 changed files with 8 additions and 7 deletions
|
|
@ -39,15 +39,16 @@ def _router_source_files() -> frozenset[str]:
|
|||
return frozenset({_HAND_CHANGES.co_filename, *(path for path in facade_files if path is not None)})
|
||||
|
||||
|
||||
def _lock_lines(path: str) -> frozenset[int]:
|
||||
return frozenset(
|
||||
number
|
||||
for number, line in enumerate(linecache.getlines(path), start=1)
|
||||
if "with self._deployment_index_lock" in line
|
||||
)
|
||||
def _lock_lines(path: str, statement: str) -> frozenset[int]:
|
||||
return frozenset(number for number, line in enumerate(linecache.getlines(path), start=1) if statement in line)
|
||||
|
||||
|
||||
_INDEX_LOCK_LINES: Final = MappingProxyType({path: _lock_lines(path) for path in _router_source_files()})
|
||||
_INDEX_LOCK_LINES: Final = MappingProxyType(
|
||||
{
|
||||
**{path: _lock_lines(path, "with self._deployment_index_lock") for path in _router_source_files()},
|
||||
_LIST_REFRESH.co_filename: _lock_lines(_LIST_REFRESH.co_filename, "with self._lock"),
|
||||
}
|
||||
)
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue