Skip to content

Commit

Permalink
Strip out setting presence state through tcp replication
Browse files Browse the repository at this point in the history
  • Loading branch information
realtyem committed Jul 3, 2023
1 parent 13fc891 commit 11f202f
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions synapse/handlers/presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,38 +1085,16 @@ async def update_external_syncs_row(
sync_time_msec: Time in ms when the user was last syncing
"""
async with self.external_sync_linearizer.queue(process_id):
prev_state = await self.current_state_for_user(user_id)

process_presence = self.external_process_to_current_syncs.setdefault(
process_id, set()
)

updates = []
if is_syncing and user_id not in process_presence:
if prev_state.state == PresenceState.OFFLINE:
updates.append(
prev_state.copy_and_replace(
state=PresenceState.ONLINE,
last_active_ts=sync_time_msec,
last_user_sync_ts=sync_time_msec,
)
)
else:
updates.append(
prev_state.copy_and_replace(last_user_sync_ts=sync_time_msec)
)
process_presence.add(user_id)
elif user_id in process_presence:
updates.append(
prev_state.copy_and_replace(last_user_sync_ts=sync_time_msec)
)

if not is_syncing:
process_presence.discard(user_id)

if updates:
await self._update_states(updates)

self.external_process_last_updated_ms[process_id] = self.clock.time_msec()

async def update_external_syncs_clear(self, process_id: str) -> None:
Expand Down

0 comments on commit 11f202f

Please sign in to comment.