From 17fb608f45338fd87748cd6fbaf5f6b767413d6b Mon Sep 17 00:00:00 2001 From: marcobaobao Date: Thu, 19 Dec 2024 12:18:36 +0100 Subject: [PATCH] code refactoring --- frontend/src/views/Livestream.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/Livestream.tsx b/frontend/src/views/Livestream.tsx index 4a7f026..a78a14b 100644 --- a/frontend/src/views/Livestream.tsx +++ b/frontend/src/views/Livestream.tsx @@ -6,8 +6,10 @@ import { Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material' +import { useAtomValue } from 'jotai' import { useState } from 'react' import { interval } from 'rxjs' +import { rpcPollingTimeState } from '../atoms/rpc' import LivestreamDialog from '../components/livestream/LivestreamDialog' import LivestreamSpeedDial from '../components/livestream/LivestreamSpeedDial' import NoLivestreams from '../components/livestream/NoLivestreams' @@ -24,7 +26,9 @@ const LiveStreamMonitorView: React.FC = () => { const [progress, setProgress] = useState() const [openDialog, setOpenDialog] = useState(false) - useSubscription(interval(1000), () => { + const rpcPollingRate = useAtomValue(rpcPollingTimeState) + + useSubscription(interval(rpcPollingRate), () => { client .progressLivestream() .then(r => setProgress(r.result))