Skip to content

Commit

Permalink
fix(api): include cache keys in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Mar 6, 2023
1 parent 35dc8a0 commit 55576ae
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/onnx_web/server/model_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def drop(self, tag: str, key: Any) -> None:
def get(self, tag: str, key: Any) -> Any:
for t, k, v in self.cache:
if tag == t and key == k:
logger.debug("found cached model: %s", tag)
logger.debug("found cached model: %s %s", tag, key)
return v

logger.debug("model not found in cache: %s", tag)
logger.debug("model not found in cache: %s %s", tag, key)
return None

def set(self, tag: str, key: Any, value: Any) -> None:
Expand All @@ -35,11 +35,11 @@ def set(self, tag: str, key: Any, value: Any) -> None:
for i in range(len(self.cache)):
t, k, v = self.cache[i]
if tag == t and key != k:
logger.debug("updating model cache: %s", tag)
logger.debug("updating model cache: %s %s", tag, key)
self.cache[i] = (tag, key, value)
return

logger.debug("adding new model to cache: %s", tag)
logger.debug("adding new model to cache: %s %s", tag, key)
self.cache.append((tag, key, value))
self.prune()

Expand Down

0 comments on commit 55576ae

Please sign in to comment.