forked from zulip/zulip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
presence: Improve INSERT conflict handling in do_update_user_presence.
This was discussed in the review of zulip#29999: zulip#29999 (comment) The previous way of handling wasn't entirely correct, as unnecessary events were omitted, with a bad guarantee of even being in the correct order. This is an improvement as now the function detects that it ended up doing nothing and can skip sending an event. The race condition is hard to make up in an automated test, but we can hackily simulate it by injecting a side_effect which will create a conflicting UserPresence row when the function requests a cursor. Aside of that, the actual race was simulated in manual testing to verify the expected behavior.
- Loading branch information
1 parent
2feee9d
commit 7ff1227
Showing
2 changed files
with
69 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