Duplicate Http requests when retrying in Elm 0.19
0 reputation · 01 Jun 2021, 05:27 UTC
Goal: Ensure that retrying a failed HTTP request does not result in duplicate writes to the backend.
Constraints: Elm’s update function is pure, so emitting the same Msg repeatedly produces the same Cmd; the Http module provides no built‑in retry, backoff, or deduplication mechanisms, and the runtime does not track in‑flight requests.
Uncertainty: The core documentation does not prescribe a canonical way to store pending request identifiers or to generate idempotency keys, leaving the pattern to application code.
- What is the recommended way to store pending request identifiers in the Model to prevent duplicate Cmds?
- How can retry logic be implemented in update without causing duplicate Http Cmds when the same Msg is re‑emitted?
- Are there established patterns for generating idempotency keys that work with Elm’s Http.send?