Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4140: don't cancel delayed state on own state #17810

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

AndrewFerr
Copy link
Member

@AndrewFerr AndrewFerr commented Oct 10, 2024

When a user sends a state event, do not cancel their own delayed events for the same piece of state.

For context, see the relevant section in the MSC.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

When a user sends a state event, do not cancel their own delayed events
for the same piece of state.
@AndrewFerr
Copy link
Member Author

Depends on matrix-org/complement#742 for Complement tests to pass.

@AndrewFerr AndrewFerr marked this pull request as ready for review October 10, 2024 13:55
@AndrewFerr AndrewFerr requested a review from a team as a code owner October 10, 2024 13:55
Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on the whole, just some small points of feedback.

@@ -0,0 +1 @@
When a user sends a state event, do not cancel their own delayed events (as per MSC4140) for the same piece of state.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically with Synapse changelog entries, we try to start with an action as the first word. Something like:

Suggested change
When a user sends a state event, do not cancel their own delayed events (as per MSC4140) for the same piece of state.
Update MSC4140 implementation to no longer cancel a user's own delayed events when they send a state event; where the state type and key match that of a scheduled delayed event.

Comment on lines +188 to +194
if delta.event_id is None:
logger.debug(
"Not handling delta for deleted state: %r %r",
delta.event_type,
delta.state_key,
)
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, would it be worth instead adding an argument to get_partial_current_state_deltas to filter out state deltas that do not have an associated event ID?

@@ -424,6 +424,7 @@ async def cancel_delayed_state_events(
room_id: str,
event_type: str,
state_key: str,
not_from_localpart: str,
) -> Optional[Timestamp]:
"""
Cancels all matching delayed state events, i.e. remove them as long as they haven't been processed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the arguments to the docstring of this function please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants