mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): do not poll for cache status unless connected, processor is running and the queue is not empty
This commit is contained in:
parent
fa54974bff
commit
77e93888cf
@ -1,17 +1,27 @@
|
|||||||
import { ButtonGroup } from '@chakra-ui/react';
|
import { ButtonGroup } from '@chakra-ui/react';
|
||||||
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
||||||
|
import { useGetQueueStatusQuery } from 'services/api/endpoints/queue';
|
||||||
import ClearInvocationCacheButton from './ClearInvocationCacheButton';
|
import ClearInvocationCacheButton from './ClearInvocationCacheButton';
|
||||||
import ToggleInvocationCacheButton from './ToggleInvocationCacheButton';
|
import ToggleInvocationCacheButton from './ToggleInvocationCacheButton';
|
||||||
import StatusStatGroup from './common/StatusStatGroup';
|
import StatusStatGroup from './common/StatusStatGroup';
|
||||||
import StatusStatItem from './common/StatusStatItem';
|
import StatusStatItem from './common/StatusStatItem';
|
||||||
|
|
||||||
const InvocationCacheStatus = () => {
|
const InvocationCacheStatus = () => {
|
||||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, {
|
|
||||||
pollingInterval: 5000,
|
|
||||||
});
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const isConnected = useAppSelector((state) => state.system.isConnected);
|
||||||
|
const { data: queueStatus } = useGetQueueStatusQuery(undefined);
|
||||||
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, {
|
||||||
|
pollingInterval:
|
||||||
|
isConnected &&
|
||||||
|
queueStatus?.processor.is_started &&
|
||||||
|
queueStatus?.queue.pending > 0
|
||||||
|
? 5000
|
||||||
|
: 0,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StatusStatGroup>
|
<StatusStatGroup>
|
||||||
<StatusStatItem
|
<StatusStatItem
|
||||||
|
Loading…
Reference in New Issue
Block a user