()
| 610 | * Polls every hour to pick up settings changes mid-session |
| 611 | */ |
| 612 | export function startBackgroundPolling(): void { |
| 613 | if (pollingIntervalId !== null) { |
| 614 | return |
| 615 | } |
| 616 | |
| 617 | if (!isRemoteManagedSettingsEligible()) { |
| 618 | return |
| 619 | } |
| 620 | |
| 621 | pollingIntervalId = setInterval(() => { |
| 622 | void pollRemoteSettings() |
| 623 | }, POLLING_INTERVAL_MS) |
| 624 | pollingIntervalId.unref() |
| 625 | |
| 626 | // Register cleanup to stop polling on shutdown |
| 627 | registerCleanup(async () => stopBackgroundPolling()) |
| 628 | } |
| 629 | |
| 630 | /** |
| 631 | * Stop background polling for remote settings |
no test coverage detected