Files
InfiniteAPI/src
Renato Alcara b90b383811 fix(inbound): ensure mutex holds until both post-upsert tasks settle
Addresses Copilot review on PR #392.

A plain `Promise.all([doAppStateSync(), processMessage(...)])` rejects on the
first task that fails. When that happens inside the messageMutex callback,
the mutex releases as soon as the rejection settles even though the other
task is still running. The next message for the same chat can then overtake
the in-flight task and break the per-chat ordering guarantee that was the
whole point of the inner mutex.

Wrap each task in its own `.catch` that logs and resolves. The combined
Promise.all now only settles after BOTH operations finish (success or
failure), so the mutex is held for the full duration of the work and
ordering is preserved. Errors are still surfaced via the per-task warnings.
2026-04-26 14:50:14 -03:00
..