()
| 633 | * Start background polling for policy limits |
| 634 | */ |
| 635 | export function startBackgroundPolling(): void { |
| 636 | if (pollingIntervalId !== null) { |
| 637 | return |
| 638 | } |
| 639 | |
| 640 | if (!isPolicyLimitsEligible()) { |
| 641 | return |
| 642 | } |
| 643 | |
| 644 | pollingIntervalId = setInterval(() => { |
| 645 | void pollPolicyLimits() |
| 646 | }, POLLING_INTERVAL_MS) |
| 647 | pollingIntervalId.unref() |
| 648 | |
| 649 | if (!cleanupRegistered) { |
| 650 | cleanupRegistered = true |
| 651 | registerCleanup(async () => stopBackgroundPolling()) |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | /** |
| 656 | * Stop background polling for policy limits |
no test coverage detected