Compare commits

...

1 Commits

Author SHA1 Message Date
Eric Bailey 32577106bd Reduce polling when app is backgrounded 2024-05-23 11:23:50 -05:00
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -4,7 +4,10 @@ import {nanoid} from 'nanoid/non-secure'
import {networkRetry} from '#/lib/async/retry'
import {logger} from '#/logger'
import {DEFAULT_POLL_INTERVAL} from '#/state/messages/events/const'
import {
BACKGROUND_POLL_INTERVAL,
DEFAULT_POLL_INTERVAL,
} from '#/state/messages/events/const'
import {
MessagesEventBusDispatch,
MessagesEventBusDispatchEvent,
@@ -287,6 +290,9 @@ export class MessagesEventBus {
const lowest = Math.min(DEFAULT_POLL_INTERVAL, ...requested)
return lowest
}
case MessagesEventBusStatus.Backgrounded: {
return BACKGROUND_POLL_INTERVAL
}
default:
return DEFAULT_POLL_INTERVAL
}
+1
View File
@@ -1 +1,2 @@
export const DEFAULT_POLL_INTERVAL = 20e3
export const BACKGROUND_POLL_INTERVAL = 60e3