You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 15, 2020. It is now read-only.
transaction.atomic() does not lock the entire table, it only journals the queries so they can be rolled back safely. On the other hand select_for_update() locks the selected row. In the current mode send_codebucks can cause a deadlock if 2 users try to send codebucks to each other, each request could acquire the sender lock and wait on the recipient lock forever. Postgres will detect this and raise an exception, and the fix would be to just restart one of the transactions until the deadlock goes away.
There may be more edge cases possible when using row-level locks that I haven't thought of. Should investigate these issues sometime, and consider locking the entire table (slow!).