All problems

A Failed Part-Status Lookup Blocks All Later Retries

Level 2 · node · Concurrency · Rejected single-flight Promise remains in the in-flight map

Scenario

A fictional equipment monitoring service lets multiple screens request the status of the same part at once. To avoid duplicate provider calls, concurrent requests for the same part share one in-flight Promise, while requests for different parts proceed independently. Normal lookups and concurrent request coalescing work, but after a temporary provider failure, all subsequent lookups for that part keep returning the old error even when the provider has recovered. Trace the asynchronous flow across the provider, status service, and controller.

Requirements

Concurrent in-flight reads for the same part ID must share one provider call. Different part IDs must be queried independently. Once a lookup settles, whether successfully or with an error, its in-flight record must be cleared so a later request starts a new provider call. Preserve the original error for callers of a failed request, but allow a subsequent request to recover when the provider succeeds. Do not permanently cache successful responses; preserve the existing function signatures and response shape.

Acceptance criteria

  • Two concurrent reads for one part call the provider only once and receive the same result.
  • Concurrent reads for different parts each invoke their own provider call.
  • After a successful lookup settles, another lookup can receive a new provider response.
  • A provider failure reaches the caller, but a later request can invoke the provider again.
  • Concurrent callers see the initial failure, and a subsequent request can recover.
  • A failure for one part does not prevent a successful lookup for another part.