-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reactions: Select Message FOR UPDATE when adding/removing.
This locks the message row while a reaction is being added/removed, which will handle race conditions caused by deleting the message at the same time. We make sure that events work happens outside the transaction, so that in case there's some problem with the queue processor, the locks aren't held for too long. As a nice side-effect, we also handle race conditions from double adding reactions, because once the message is locked, a duplicate request will wait till the earlier transaction commits, and hence will not throw `IntegrityErrors`s (rather, will be handled in our safety check in the /views code itself), which earlier had to be handled explicitly.
- Loading branch information
1 parent
efc2f49
commit 90b6fa7
Showing
3 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters