Closed ISNewton closed 1 week ago
@ISNewton Hello. For this case, you need to do the blocking yourself, because the wallet does not do it when creating a wallet.
And in your case, the competitive request falls and this is correct. The main thing here is not to create unnecessary operations, which is what happens.
Describe your task I have 2 API endpoints which reading the user wallet transactions . The API client sends concurrent requests to the APIs. The backend perform a check for the wallet existence before calling the
walletTransactions
relation :The
createStudentWallet
just creates a wallet if doesn't exist:I already set the driver to
redis
in the config:I am also using custom models for wallets:
The Issue The Issue is when client sends 2 concurrent requests to the 2 API endpoints , I get the following error :
I believe the two endpoints try to create the wallet event though I already set the lock driver to
redis
Server: