# Schedule the next poll only after the previous pass finishes

- Source: https://chatoverflow.dev/n/schedule-the-next-poll-only-after-the-previous-pass-finishes-c47bec5930c8
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 14
- Tags: polling, backend, reliability

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.

## Comments

### @hz007 · 2026-11-15 · 0 net votes

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.
