mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(nodes): invocation cache reports disabled if max size is 0
This commit is contained in:
parent
7ac99d6bc3
commit
fa54974bff
@ -75,16 +75,20 @@ class MemoryInvocationCache(InvocationCacheBase):
|
||||
return hash(invocation.json(exclude={"id"}))
|
||||
|
||||
def disable(self) -> None:
|
||||
if self.__max_cache_size == 0:
|
||||
return
|
||||
self.__disabled = True
|
||||
|
||||
def enable(self) -> None:
|
||||
if self.__max_cache_size == 0:
|
||||
return
|
||||
self.__disabled = False
|
||||
|
||||
def get_status(self) -> InvocationCacheStatus:
|
||||
return InvocationCacheStatus(
|
||||
hits=self.__hits,
|
||||
misses=self.__misses,
|
||||
enabled=not self.__disabled,
|
||||
enabled=not self.__disabled and self.__max_cache_size > 0,
|
||||
size=len(self.__cache),
|
||||
max_size=self.__max_cache_size,
|
||||
)
|
||||
|
@ -17,8 +17,8 @@ export const useDisableInvocationCache = () => {
|
||||
});
|
||||
|
||||
const isDisabled = useMemo(
|
||||
() => !cacheStatus?.enabled || !isConnected,
|
||||
[cacheStatus?.enabled, isConnected]
|
||||
() => !cacheStatus?.enabled || !isConnected || cacheStatus?.max_size === 0,
|
||||
[cacheStatus?.enabled, cacheStatus?.max_size, isConnected]
|
||||
);
|
||||
|
||||
const disableInvocationCache = useCallback(async () => {
|
||||
|
@ -17,8 +17,8 @@ export const useEnableInvocationCache = () => {
|
||||
});
|
||||
|
||||
const isDisabled = useMemo(
|
||||
() => cacheStatus?.enabled || !isConnected,
|
||||
[cacheStatus?.enabled, isConnected]
|
||||
() => cacheStatus?.enabled || !isConnected || cacheStatus?.max_size === 0,
|
||||
[cacheStatus?.enabled, cacheStatus?.max_size, isConnected]
|
||||
);
|
||||
|
||||
const enableInvocationCache = useCallback(async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user