D
D
daminik002020-08-25 21:34:31
Node.js
daminik00, 2020-08-25 21:34:31

How to work with the user's wallet?

There are two types of users: performer and advertiser.
The advertiser replenishes the wallet and creates a task.
Performers complete tasks and receive money in their wallet.
As soon as the advertiser's account runs out of money, the performers stop showing tasks.

The problem is that with the current implementation, the check to see if the advertiser has money in his wallet or not is not correct. Perhaps due to the fact that there are a lot of requests from performers at the same time and it turns out that 10 performers are checking at the same time, these 10 performers are shown that there is money, but in fact there is money for only 1. As a result, the advertiser goes into the red. How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
3
3ton, 2020-09-07
@3ton

In your scheme, it is not entirely clear at what point the task is booked and whether there is such a concept.
If you do not have a booking for a task, then it is normal that several people can take on the task at once, and therefore you must determine whether everyone should pay, or the one who completed it first.
As soon as you add a task booking, after the performer has booked it for himself, it should not be displayed to other participants, and no one can take it and re-execute it. Thus, the repeated amount for this task will not be debited to another participant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question