Reduce polling when app is backgrounded (#4192)
parent
d051614342
commit
9011c11eaf
|
@ -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 +1,2 @@
|
|||
export const DEFAULT_POLL_INTERVAL = 20e3
|
||||
export const BACKGROUND_POLL_INTERVAL = 60e3
|
||||
|
|
Loading…
Reference in New Issue