diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-04-26 12:38:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 12:38:14 +0100 |
commit | 63b75cf7d70db28924f29bce55b55f567d8053f2 (patch) | |
tree | 1c52064312301e9f6262089e3110f948694e49db /synapse | |
parent | Merge remote-tracking branch 'origin/master' into develop (diff) | |
parent | Fix infinite loop in presence handler (diff) | |
download | synapse-63b75cf7d70db28924f29bce55b55f567d8053f2.tar.xz |
Merge pull request #5103 from matrix-org/rav/fix_notif_loop
Fix infinite loop in presence handler
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/presence.py | 5 | ||||
-rw-r--r-- | synapse/storage/state_deltas.py | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index bd1285b15c..59d53f1050 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -828,6 +828,11 @@ class PresenceHandler(object): if typ != EventTypes.Member: continue + if event_id is None: + # state has been deleted, so this is not a join. We only care about + # joins. + continue + event = yield self.store.get_event(event_id) if event.content.get("membership") != Membership.JOIN: # We only care about joins diff --git a/synapse/storage/state_deltas.py b/synapse/storage/state_deltas.py index 56e42f583d..31a0279b18 100644 --- a/synapse/storage/state_deltas.py +++ b/synapse/storage/state_deltas.py @@ -22,6 +22,24 @@ logger = logging.getLogger(__name__) class StateDeltasStore(SQLBaseStore): def get_current_state_deltas(self, prev_stream_id): + """Fetch a list of room state changes since the given stream id + + Each entry in the result contains the following fields: + - stream_id (int) + - room_id (str) + - type (str): event type + - state_key (str): + - event_id (str|None): new event_id for this state key. None if the + state has been deleted. + - prev_event_id (str|None): previous event_id for this state key. None + if it's new state. + + Args: + prev_stream_id (int): point to get changes since (exclusive) + + Returns: + Deferred[list[dict]]: results + """ prev_stream_id = int(prev_stream_id) if not self._curr_state_delta_stream_cache.has_any_entity_changed( prev_stream_id |