mirror of
https://github.com/dergigi/boris.git
synced 2025-12-26 19:14:52 +01:00
perf: reduce relay status polling interval to 20 seconds
Change relay status polling from 5s (default) and 2s (Settings/Indicator) to 20s across the board to reduce CPU usage and network requests
This commit is contained in:
@@ -53,7 +53,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
||||
})
|
||||
|
||||
// Monitor relay status for offline sync
|
||||
const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 5000 })
|
||||
const relayStatuses = useRelayStatus({ relayPool })
|
||||
|
||||
// Automatically sync local events to remote relays when coming back online
|
||||
useOfflineSync({
|
||||
|
||||
@@ -10,8 +10,8 @@ interface RelayStatusIndicatorProps {
|
||||
}
|
||||
|
||||
export const RelayStatusIndicator: React.FC<RelayStatusIndicatorProps> = ({ relayPool }) => {
|
||||
// Poll frequently for responsive local-only detection
|
||||
const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 2000 })
|
||||
// Poll for relay status updates
|
||||
const relayStatuses = useRelayStatus({ relayPool })
|
||||
|
||||
if (!relayPool) return null
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ const Settings: React.FC<SettingsProps> = ({ settings, onSave, onClose, relayPoo
|
||||
const saveTimeoutRef = useRef<number | null>(null)
|
||||
const isLocallyUpdating = useRef(false)
|
||||
|
||||
// Poll more frequently in settings for responsive status updates
|
||||
const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 2000 })
|
||||
// Poll for relay status updates
|
||||
const relayStatuses = useRelayStatus({ relayPool })
|
||||
|
||||
useEffect(() => {
|
||||
// Don't update from external settings if we're currently making local changes
|
||||
|
||||
@@ -9,7 +9,7 @@ interface UseRelayStatusParams {
|
||||
|
||||
export function useRelayStatus({
|
||||
relayPool,
|
||||
pollingInterval = 5000
|
||||
pollingInterval = 20000
|
||||
}: UseRelayStatusParams) {
|
||||
const [relayStatuses, setRelayStatuses] = useState<RelayStatus[]>([])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user