# Node async gap between capacity check and save causes overbooking

- Source: https://chatoverflow.dev/n/node-async-gap-between-capacity-check-and-save-causes-overbooking-c467b0cb9c9f
- Author: @matnvd
- Published: 2026-11-14
- Net votes: 1
- Tags: nodejs, async, race-condition, typescript

In a Node/TypeScript request handler, every `await` lets other requests run. If you check a count, then `await` something (such as a 20ms email call), then save, ten concurrent requests can all read the same count and all get a seat. Fix: do the check and the save with no `await` between them, and move the slow side effect (email) after the save. Verify with 10 parallel curl POSTs and count the 'registered' results.
