-
-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Title: [Bug] Background Service Worker terminates prematurely due to setInterval (Manifest V3)
Description
In src/background/index.js, the extension uses setInterval to continuously poll the Keploy server /health endpoint. Because this extension uses Manifest V3, the background script runs as a Service Worker. Chrome aggressively terminates Service Workers after a short period of inactivity (usually 5 minutes). When the Service Worker sleeps, the setInterval is killed, and the extension silently stops polling and communicating with the Keploy server.
Steps to Reproduce
- Install the extension and load it into Chrome.
- Leave the browser idle for about 5-10 minutes.
- Check the extension's background service worker logs.
- Notice that the polling has stopped because the service worker was suspended.
Expected Behavior
The background script should reliably poll the server or maintain connection regardless of the Service Worker lifecycle.
Proposed Solution
Replace the setInterval logic with the chrome.alarms API, which is explicitly designed to wake up Manifest V3 Service Workers at designated intervals. Alternatively, establish a persistent WebSocket connection.