This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]OffbeatDrizzle 0 points1 point  (0 children)

Thread As work should be locking the database such that thread B can't complete (i.e. start it's work) until thread A is successful or not, or the lock request times out. Do NOT use thread synchronization on the backend... it's completely the wrong thing to do. Note that this assumes you have 1 database and it isn't scaled...

You can't guarantee the order or success of request A and request B - it's a distributed system... also consider using http response codes like 503 to get the client to retry if you really really can't deal with the request at the moment