diff --git a/src/components/common/Loki/LokiPanel.jsx b/src/components/common/Loki/LokiPanel.jsx index 81f268c8b00a727eda5ccad913526ef94b560b01..3600273987f3e637c752e83c5db11570475a00eb 100644 --- a/src/components/common/Loki/LokiPanel.jsx +++ b/src/components/common/Loki/LokiPanel.jsx @@ -40,7 +40,6 @@ export function LokiPanel({ hostName, iocName, isSyslog, isExpanded }) { const [periodChange, setPeriodChange] = useState(false); const [alertIds, setAlertIds] = useState([]); const [html, setHtml] = useState(""); - const [abortPolling, setAbortPolling] = useState(false); const preprocessLog = useCallback( (logData, showWarning, timeRange, alertIds, setAlertIds) => { @@ -115,14 +114,14 @@ export function LokiPanel({ hostName, iocName, isSyslog, isExpanded }) { getSysLogData, { data: sysLogData, error: sysLogError, isLoading: sysDataIsLoading } ] = useLazyFetchSyslogLinesQuery({ - pollingInterval: !abortPolling ? LOG_POLL_INTERVAL : 0 + pollingInterval: isExpanded ? LOG_POLL_INTERVAL : 0 }); const [ getProcServLog, { data: procServLog, error: procServLogError, isLoading: procDataIsLoading } ] = useLazyFetchProcServLogLinesQuery({ - pollingInterval: !abortPolling ? LOG_POLL_INTERVAL : 0 + pollingInterval: isExpanded ? LOG_POLL_INTERVAL : 0 }); const hasLogError = !!sysLogError || !!procServLogError; @@ -150,14 +149,11 @@ export function LokiPanel({ hostName, iocName, isSyslog, isExpanded }) { useEffect(() => { if (isExpanded) { - setAbortPolling(false); if (isSyslog === true) { getSysLogData(params); } else { getProcServLog(params); } - } else { - setAbortPolling(true); } }, [getSysLogData, getProcServLog, isSyslog, isExpanded, params]); diff --git a/src/components/deployments/DeploymentJobOutput.jsx b/src/components/deployments/DeploymentJobOutput.jsx index 7044c0855521f119c84ac44f5d1b7fdea9f7bbaf..40168276b327a1b90631b4edda140b173b850b70 100644 --- a/src/components/deployments/DeploymentJobOutput.jsx +++ b/src/components/deployments/DeploymentJobOutput.jsx @@ -11,7 +11,6 @@ const LOG_POLL_INTERVAL = 5000; export function DeploymentJobOutput({ job, isExpanded }) { const [consoleDialogOpen, setConsoleDialogOpen] = useState(false); const finalResultsNeeded = useRef(true); - const [abortPolling, setAbortPolling] = useState(false); const params = useMemo( () => ({ awx_job_id: job.awxJobId @@ -20,18 +19,15 @@ export function DeploymentJobOutput({ job, isExpanded }) { ); const [getLogById, { data: log, isSuccess: logDataReady, error: logError }] = useLazyFetchDeploymentJobLogQuery({ - pollingInterval: !abortPolling ? LOG_POLL_INTERVAL : 0 + pollingInterval: isExpanded ? LOG_POLL_INTERVAL : 0 }); useEffect(() => { if (isExpanded) { - setAbortPolling(false); if (!job.finishedAt || finalResultsNeeded.current) { getLogById(params); finalResultsNeeded.current = !job.finishedAt; } - } else { - setAbortPolling(true); } }, [job.finishedAt, job.jobId, isExpanded, getLogById, params]);