-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Firstly, thank you for creating this example, it's been great for me trying to learn GraphQL.
One query I wrote when thinking about transactions was to check in two pets at the same time. This uncovered a race condition where the code here:
pet-library/src/resolvers/Mutation.js
Lines 102 to 109 in 6841a5e
| await customers.updateOne( | |
| { username: currentCustomer.username }, | |
| { | |
| $set: { | |
| checkoutHistory: [checkout, ...currentCustomer.checkoutHistory] | |
| } | |
| } | |
| ); |
uses currentCustomer from the context without updating it. So both checkins happen, the first one updates my checkout history to include the first checkout, and the second checkin then overwrites my history as only containing that second checkin. This means my first checkin is lost.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels