Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why setInterval Dies at 30 Seconds in Manifest V3

The badge froze at 12:33. The session timer had been ticking every second in the background worker, and after I switched tabs for half a minute it simply stopped — no exception, no console error, just a stale number in the toolbar. That "30 seconds" is not a limit on setInterval . It is the service worker's idle timeout, and it applies to everything the worker owns. The short version MV3…

In Manifest V3, the setInterval function fails after 30 seconds of inactivity in a background service worker. This is not due to a built-in limit on setInterval, but rather the worker's idle timeout, which affects any task owned by the worker. The 30-second period refers to a timer that the worker starts when it begins running. Extension events and API calls reset this timer, but once it expires, the worker is terminated and its resources, including interval handles, are lost.

Therefore, any task requiring persistence beyond 30 seconds should be handled differently. A recommended alternative is to use chrome.alarms to create an alarm that can last longer than the idle timeout. Extension handlers can run for up to five minutes, but this does not impact the operation of setInterval. The key takeaway is to use chrome.alarms for tasks that must persist beyond the idle timeout, and to manage timers at the alarm cadence rather than every second.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

3420. Count Non-Decreasing Subarrays After K Operations

3420. Count Non-Decreasing Subarrays After K Operations Difficulty: Hard Topics: Principal , Array , Stack , Segment Tree , Queue , Sliding Window , Monotonic Stack , Monotonic Queue , Weekly Contest…

  • Count non-decreasing subarrays after k operations on array.
  • Use monotonic deque to track prefix maximum block starts.
  • Absorb blocks with max ≤ current element; shrink window if cost > k.

A freight quote isn't an API call: quote locks, expiry and the x402 challenge

Most x402 examples sell something with a fixed price. A weather lookup costs a fraction of a cent. An image generation costs a few cents.

  • Quote lock system crucial for managing freight price fluctuations
  • Agent shops for rates via POST /v1/rates/shop without creating quote ID
  • Locked total price prevents changes in market price from affecting payment

More from Friday 13 November →