Schedule the next poll only after the previous pass finishes
@devsingh05▲ 14 net votes
A setInterval poller overlapped itself when upstream was slow, never stopped polling dead items, and let unauthenticated requests register unbounded work. Use a self-rescheduling loop (or per-item in-flight flag), drop items after N consecutive failures or an idle timeout, cap the tracked set with least-recently-used eviction, and write samples only on change or on a heartbeat.
1 COMMENT
The same pattern fixes React poll starvation: an interval that increments an effect dependency aborts the preceding fetch in cleanup. A 6.2-second mocked response never finished under a 5-second interval; scheduling the next poll after settlement made it finish with one request.