diff --git a/dashboard/pages/fragment_graph.tsx b/dashboard/pages/fragment_graph.tsx index f7b3764a6bf4a..bcc7f8cf725f6 100644 --- a/dashboard/pages/fragment_graph.tsx +++ b/dashboard/pages/fragment_graph.tsx @@ -253,18 +253,19 @@ export default function Streaming() { const toast = useErrorToast() useEffect(() => { - const interval = setInterval(() => { - const fetchNewBP = async () => { - const newBP = await getBackPressureWithoutPrometheus() - setPreviousBP(currentBP) - setCurrentBP(newBP) - } - - fetchNewBP().catch(console.error) - }, INTERVAL) + if (backPressureDataSourceAlgo === "Embedded") { + const interval = setInterval(() => { + const fetchNewBP = async () => { + const newBP = await getBackPressureWithoutPrometheus() + setPreviousBP(currentBP) + setCurrentBP(newBP) + } - return () => clearInterval(interval) - }, [currentBP]) + fetchNewBP().catch(console.error) + }, INTERVAL) + return () => clearInterval(interval) + } + }, [currentBP, backPressureDataSourceAlgo]) useEffect(() => { if (currentBP !== null && previousBP !== null) {