diff --git a/semantic_router/index/base.py b/semantic_router/index/base.py index 7c88a1e56ef6b8b84eff77b1c3c50a945442be70..cae6d90c99430df6c79a6be06dee153c1ef4457e 100644 --- a/semantic_router/index/base.py +++ b/semantic_router/index/base.py @@ -214,7 +214,7 @@ class BaseIndex(BaseModel): if self._is_locked(scope=scope) != value: # in this case, we can set the lock value break - if (datetime.now() - start_time).total_seconds() > wait: + if (datetime.now() - start_time).total_seconds() < wait: # wait for 2.5 seconds before checking again time.sleep(2.5) else: diff --git a/semantic_router/routers/base.py b/semantic_router/routers/base.py index 347c5db9e8468dd066cbef9c227ac9c27bb0a405..328cf2b77c4ff45bed8c861dda72407568841451 100644 --- a/semantic_router/routers/base.py +++ b/semantic_router/routers/base.py @@ -840,13 +840,9 @@ class BaseRouter(BaseModel): return config.get_hash() def _write_hash(self) -> ConfigParameter: - # lock index before writing - _ = self.index.lock(value=True) config = self.to_config() hash_config = config.get_hash() self.index._write_config(config=hash_config) - # unlock index after writing - _ = self.index.lock(value=False) return hash_config def is_synced(self) -> bool: