Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Draft: Ignore sending events to appservice when they come from our own homeserver #14729

Closed

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Dec 23, 2022

Ignore sending events to appservice when they come from our own homeserver

This is a rough patch for the Gitter homeserver so we can better cope with the massive import load. Since we're the ones who imported the messages and the only ones who send messages on the homeserver, we can safely ignore any events that come from us since we already know about the events on the Gitter side.

Currently, we import a bunch of messages Gitter -> Synapse and Synapse sends them back to us via the appservice where they are ignored on the Gitter bridge side via the suppressEcho option in matrix-appservice-bridge. But just the overhead of ignoring all of the transactions isn't fast enough to keep up. Instead of having the round-trip just to ignore, we can ignore directly in Synapse to not send to us via the appservice.

This logic only really applies to the Gitter situation but if we can write a more general patch in the future, it would be good to ignore events that come in through the appservice to not go back out the appservice that sent it. This probably requires a MSC to define the behavior in the AS registration config.

An alternative, is to something like #3237 which ignores any old events which for the Gitter import would be perfectly fine since we're only importing old messages. And on the Gitter side of the bridge, we already ignore any events older than 30 minutes anyway so a solution to that separate issue makes sense in any case.


Context:

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.
  • Pull request includes a sign off
  • Code style is correct
    (run the linters)

@MadLittleMods MadLittleMods added the A-Application-Service Related to AS support label Dec 23, 2022
@MadLittleMods
Copy link
Contributor Author

Created #14776 to track adding this kind of functionality to Synapse itself

# them and sent them ourself.
events = [
event for event in events if not self._hs.is_mine_id(event.sender)
]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update: @turt2live shared a similar t2bot.io patch that they've been running for a long-time: t2bot@3c1cd9a

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Application-Service Related to AS support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants