Prevent concurrent lambda from accessing the same resources from Dynamodb in the same time

Viewed 14

I have a scenario as follows:

Two kinds of assets with two different statuses "In stock" and "New"

The lambda implementation tries to check if there are assets with in-stock status and reserve them, but if there are no any in stock available it will create new assets with the status New.

But I am facing a problem that all events create new assets even if there are enough assets in stock.

I am pretty sure its a concurrency problem so what do you suggest here?

I tried to block then unblock assets at the begging of the request but it did not work well with concurrency

0 Answers
Related