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
invokeai
app/services/invocation_cache
frontend/web/src/features/queue/hooks
@ -75,16 +75,20 @@ class MemoryInvocationCache(InvocationCacheBase):
|
|||||||
return hash(invocation.json(exclude={"id"}))
|
return hash(invocation.json(exclude={"id"}))
|
||||||
|
|
||||||
def disable(self) -> None:
|
def disable(self) -> None:
|
||||||
|
if self.__max_cache_size == 0:
|
||||||
|
return
|
||||||
self.__disabled = True
|
self.__disabled = True
|
||||||
|
|
||||||
def enable(self) -> None:
|
def enable(self) -> None:
|
||||||
|
if self.__max_cache_size == 0:
|
||||||
|
return
|
||||||
self.__disabled = False
|
self.__disabled = False
|
||||||
|
|
||||||
def get_status(self) -> InvocationCacheStatus:
|
def get_status(self) -> InvocationCacheStatus:
|
||||||
return InvocationCacheStatus(
|
return InvocationCacheStatus(
|
||||||
hits=self.__hits,
|
hits=self.__hits,
|
||||||
misses=self.__misses,
|
misses=self.__misses,
|
||||||
enabled=not self.__disabled,
|
enabled=not self.__disabled and self.__max_cache_size > 0,
|
||||||
size=len(self.__cache),
|
size=len(self.__cache),
|
||||||
max_size=self.__max_cache_size,
|
max_size=self.__max_cache_size,
|
||||||
)
|
)
|
||||||
|
@ -17,8 +17,8 @@ export const useDisableInvocationCache = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const isDisabled = useMemo(
|
const isDisabled = useMemo(
|
||||||
() => !cacheStatus?.enabled || !isConnected,
|
() => !cacheStatus?.enabled || !isConnected || cacheStatus?.max_size === 0,
|
||||||
[cacheStatus?.enabled, isConnected]
|
[cacheStatus?.enabled, cacheStatus?.max_size, isConnected]
|
||||||
);
|
);
|
||||||
|
|
||||||
const disableInvocationCache = useCallback(async () => {
|
const disableInvocationCache = useCallback(async () => {
|
||||||
|
@ -17,8 +17,8 @@ export const useEnableInvocationCache = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const isDisabled = useMemo(
|
const isDisabled = useMemo(
|
||||||
() => cacheStatus?.enabled || !isConnected,
|
() => cacheStatus?.enabled || !isConnected || cacheStatus?.max_size === 0,
|
||||||
[cacheStatus?.enabled, isConnected]
|
[cacheStatus?.enabled, cacheStatus?.max_size, isConnected]
|
||||||
);
|
);
|
||||||
|
|
||||||
const enableInvocationCache = useCallback(async () => {
|
const enableInvocationCache = useCallback(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user