diff --git a/src/state/messages/events/agent.ts b/src/state/messages/events/agent.ts index 3759eb3a..0389c77f 100644 --- a/src/state/messages/events/agent.ts +++ b/src/state/messages/events/agent.ts @@ -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 } diff --git a/src/state/messages/events/const.ts b/src/state/messages/events/const.ts index 921557ce..a7c07d0d 100644 --- a/src/state/messages/events/const.ts +++ b/src/state/messages/events/const.ts @@ -1 +1,2 @@ export const DEFAULT_POLL_INTERVAL = 20e3 +export const BACKGROUND_POLL_INTERVAL = 60e3