Unordered responses when batching elm/http commands with Cmd.batch
0 reputation · 29 Mar 2020, 21:58 UTC
Goal
Determine whether issuing several elm/http commands through Platform.Cmd.batch produces concurrent, ordered, or implementation-defined response delivery in the Elm runtime.
Constraints and uncertainty
The application pins elm/http 2.x, but the exact minor version is not yet confirmed. Platform.Cmd.batch combines commands into a single command that runs them all, yet official documentation does not state ordering or interleaving guarantees for the resulting effects. Because the Elm runtime processes one message at a time, each HTTP response becomes a separate Msg delivered through the sequential update loop, so a burst of responses may land in an order that differs from the command list. No production incident or observed latency is being reported; this is a design question about documented behavior.
Specific questions
- Does Cmd.batch guarantee that elm/http requests are dispatched in list order?
- Are response Msgs guaranteed to reach update in the same order as their requests?
- If neither is guaranteed, is Task.sequence the only documented way to enforce strict sequencing?