Skip to content

Frontend polling may create overlapping requests #57

Description

@nathabee

Anomaly 4 — Frontend polling may create overlapping requests

Title

Dashboard polling should prevent overlapping API requests

Type

bug, frontend, performance, polling

Problem

The dashboard appears to poll /printers and /jobs every few seconds. If the backend is slow, unreachable, or blocked, a new polling tick may start before the previous request has completed.

This can produce request accumulation:

t=0s   GET /printers starts
t=5s   previous still pending, new GET /printers starts
t=10s  another GET /printers starts
...

Over time this can make both frontend and backend behavior worse.

Expected behavior

Polling must be non-overlapping.

For each polling loop:

  • do not start a new request if the previous one is still running
  • optionally abort old request with AbortController
  • count timeout/network failures
  • keep only the latest successful state
  • avoid updating the DOM from stale responses

Acceptance criteria

  • If /printers request is still pending, the next /printers poll is skipped or delayed.
  • If /jobs request is still pending, the next /jobs poll is skipped or delayed.
  • Slow backend responses do not create a request backlog.
  • Stale responses cannot overwrite newer dashboard state.
  • Network failures are counted by the offline-state mechanism.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions