From 7d683b4db6484b5a228a9d271db321adfb357679 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:48:58 +1000 Subject: [PATCH] fix(nodes): do not disable invocation cache delete methods When the runtime disabled flag is on, do not skip the delete methods. This could lead to a hit on a missing resource. Do skip them when the cache size is 0, because the user cannot change this (must restart app to change it). --- .../services/invocation_cache/invocation_cache_memory.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/invokeai/app/services/invocation_cache/invocation_cache_memory.py b/invokeai/app/services/invocation_cache/invocation_cache_memory.py index be1d0686e2..d56b2c3d3b 100644 --- a/invokeai/app/services/invocation_cache/invocation_cache_memory.py +++ b/invokeai/app/services/invocation_cache/invocation_cache_memory.py @@ -56,14 +56,14 @@ class MemoryInvocationCache(InvocationCacheBase): pass def delete(self, key: Union[int, str]) -> None: - if self.__max_cache_size == 0 or self.__disabled: + if self.__max_cache_size == 0: return if key in self.__cache: del self.__cache[key] def clear(self, *args, **kwargs) -> None: - if self.__max_cache_size == 0 or self.__disabled: + if self.__max_cache_size == 0: return self.__cache.clear() @@ -94,7 +94,7 @@ class MemoryInvocationCache(InvocationCacheBase): ) def _delete_by_match(self, to_match: str) -> None: - if self.__max_cache_size == 0 or self.__disabled: + if self.__max_cache_size == 0: return keys_to_delete = set()