C
C#2y ago
pwnage

❔ Preventing over-allocation over limit in database with lots of concurrent requests?

Hey. I have a webapi controller endpoint, that calls another service, and it takes around 5-6 seconds for other service to calculate if success or fail. Based on success or fail, I would store the data in database. I have a limitation setting in my db on how many rows can be saved. For instance if limit is 50 people, it should allow only 50 successful people to claim a spot. It acts like first come first serve. Any suggestion on how to prevent over-insertion/over-allocation of rows over that maximum limit, if i have tons of users doing request at the same time? I was thinking about queue, but the problem is that, let's say 20 people are queuing and if 3rd service takes on average 5s to respond, the 20th in queue would wait 100 seconds for result.
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
pwnage
pwnageOP2y ago
blockchain
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server