I dont have any bugs with confict data right now but i wanna know what if we have this situation:
A and B are users. They want to get access to telescope. If telescope is free user can get access and telescope becomes busy. All works fine if:
-
- User A send get request →
-
- Telescope availiable
-
- A send post request and change telescope status →
-
- Telescope becomes busy
-
- User B send get request →
-
- Telescope is busy, try of access to telescope regected
But if users press “get access to telescope” button at the same time:
- User A send get request →
- User B send get request →
- Telescope availiable (for user A)
B get request is already in node.js event loop → - Telescope availiable (for user B)
- A send post request and change telescope status →
- Telescope becomes busy
- B send post request and change telescope status →
- Telescope becomes busy (again)
How to deal with it?