This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add a linearizer on (appservice, stream) when handling ephemeral events. #11207
Merged
anoadragon453
merged 13 commits into
matrix-org:develop
from
Fizzadar:linearize-as-ephemeral-event-handling
Nov 3, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4726c83
Add a linearizer on (appservice, stream) when handling ephemeral events.
Fizzadar c25bc99
Add changelog entry.
Fizzadar 7959d0e
Update name of linearizer for as ephemeral events.
Fizzadar 1d9ea27
Update changelog language.
Fizzadar f8f3c4a
Reject handling tokens lower than the currently stored position.
Fizzadar 1f2b14c
Add tests for appservice ephemeral notifications.
Fizzadar 9445883
Lint `test_appservice.py`.
Fizzadar bc991c2
Replace exception with log & empty return when stream tokens invalid.
Fizzadar 451c31f
Add docstrings to ephemeral appservice tests.
Fizzadar 88d2d5c
Always set the stream position, even when there are no events.
Fizzadar 2d924c5
Remove check that set stream has not been called.
Fizzadar e76e59c
Update debug log line
anoadragon453 36ecd70
lint
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix a long-standing bug which could result in serialization errors and potentially duplicate transaction data when sending ephemeral events to application services. Contributed by @Fizzadar at Beeper. |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're sure that we're processing events in order, we should probably add a conditional that bails out early if
new_token
is less than or equal to the stored stream token for the appservice/stream ID combo.This should probably be done right after we call
get_type_stream_id_for_appservice
in_handle_receipts
and_handle_presence
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in f8f3c4a. I also attempted to de-dupe some of the logic here but not sure it's any better as the handle functions take different arguments; pushed to Fizzadar@8e5e670, I can pull that in if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a very useful refactor, I'd love to pull it in. However, let's include it in a separate PR if you don't mind - as it will make the overall diff a bit messier.