Nodejs express and mongodb how to manage concurrent requests to endpoint

Viewed 38

I've recently faced a problem when load testing my api, i have a post request to place order and a transaction tracker to save order products count and before and after, So when calling the endpoint only 10 times the results in the transaction tracker got mixed up the order the requests works with is


Register Before ➡️ Save order ➡️ Decrement warehouse ➡️ Register After And save to database


Update
The Problem is when Sending 10 or 100 requests nodejs runs them concurrently thus the first 5 dosent get to the register after stage before the secound 5 gets to the register before, and this will cause the after data to be incorrect

0 Answers
Related