This repository was archived by the owner on Jun 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Investigate Concurrency Issues #94
Copy link
Copy link
Open
Labels
codebankAnything related to codebankAnything related to codebank
Milestone
Description
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!).
Metadata
Metadata
Assignees
Labels
codebankAnything related to codebankAnything related to codebank