T
T
tttttv2022-04-13 19:37:44
Django
tttttv, 2022-04-13 19:37:44

How to do a blocking operation in Python Django?

Implemented, for example, the user's balance, a function that writes off conditional money from this balance and does something (if there is enough money on the balance).

In this case, a field for fraud arises - for example, with a balance of 1000, you can simultaneously call the function to debit 1000 twice, they both check the balance, both are successful, and 1000 is debited twice.

Accordingly, the question is how blocking operations can be implemented in Django to avoid this ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-04-13
@bacon

https://docs.djangoproject.com/en/4.0/ref/models/q... although the question is no longer about Django, but about knowledge of the DBMS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question