Skip to content

AsyncMutex in exportQuota.ts and the per-request idempotency queue in idempotency.ts duplicate the same wait-queue pattern #1438

Description

@1nonlypiece

src/services/exportQuota.ts implements its own small AsyncMutex class (lines 35-54) to serialize in-memory quota increments, while src/services/idempotency.ts implements a conceptually similar pendingIdempotencyRequests promise-queue mechanism for coalescing concurrent identical requests — two independent, hand-rolled implementations of "coordinate concurrent async operations in-process" living in different files with no shared utility. Beyond the duplication itself, neither implementation is exercised by a shared, dedicated concurrency-primitive test suite; each is only tested indirectly through its specific caller's tests. Extracting a single, well-tested AsyncMutex/queue utility (e.g. into src/utils/) would reduce duplicated logic and let both consumers benefit from one hardened implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions