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
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14729.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't merge this.
10 changes: 10 additions & 0 deletions synapse/appservice/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ApplicationServiceScheduler:
"""

def __init__(self, hs: "HomeServer"):
self._hs = hs
self.clock = hs.get_clock()
self.store = hs.get_datastores().main
self.as_api = hs.get_application_service_api()
Expand Down Expand Up @@ -149,6 +150,15 @@ def enqueue_for_appservice(
return

if events:
# XXX: Special patch just for Gitter which we should remove after the import,
# https://github.com/matrix-org/synapse/pull/14729
#
# Ignore events that come from our own users. We probably already know about
# 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


self.queuer.queued_events.setdefault(appservice.id, []).extend(events)
MadLittleMods marked this conversation as resolved.
Show resolved Hide resolved
if ephemeral:
self.queuer.queued_ephemeral.setdefault(appservice.id, []).extend(ephemeral)
Expand Down