mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 13:43:51 +01:00
parent
ce6d47934b
commit
bd0d45ca69
3 changed files with 24 additions and 0 deletions
1
changelog.d/5103.bugfix
Normal file
1
changelog.d/5103.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix bug where presence updates were sent to all servers in a room when a new server joined, rather than to just the new server.
|
|
@ -828,6 +828,11 @@ class PresenceHandler(object):
|
||||||
if typ != EventTypes.Member:
|
if typ != EventTypes.Member:
|
||||||
continue
|
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)
|
event = yield self.store.get_event(event_id)
|
||||||
if event.content.get("membership") != Membership.JOIN:
|
if event.content.get("membership") != Membership.JOIN:
|
||||||
# We only care about joins
|
# We only care about joins
|
||||||
|
|
|
@ -22,6 +22,24 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class StateDeltasStore(SQLBaseStore):
|
class StateDeltasStore(SQLBaseStore):
|
||||||
def get_current_state_deltas(self, prev_stream_id):
|
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)
|
prev_stream_id = int(prev_stream_id)
|
||||||
if not self._curr_state_delta_stream_cache.has_any_entity_changed(
|
if not self._curr_state_delta_stream_cache.has_any_entity_changed(
|
||||||
prev_stream_id
|
prev_stream_id
|
||||||
|
|
Loading…
Reference in a new issue