0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-16 09:33:52 +01:00

Add fallback to last_active_ts if it beats the last sync time.

This commit is contained in:
Will Hunt 2017-03-15 15:17:16 +00:00
parent 5f14e7e982
commit ebf5a6b14c

View file

@ -1157,7 +1157,8 @@ def handle_timeout(state, is_mine, syncing_user_ids, now):
# If there are have been no sync for a while (and none ongoing), # If there are have been no sync for a while (and none ongoing),
# set presence to offline # set presence to offline
if user_id not in syncing_user_ids: if user_id not in syncing_user_ids:
if now - state.last_user_sync_ts > SYNC_ONLINE_TIMEOUT: sync_or_active = max(state.last_user_sync_ts, state.last_active_ts)
if now - sync_or_active > SYNC_ONLINE_TIMEOUT:
state = state.copy_and_replace( state = state.copy_and_replace(
state=PresenceState.OFFLINE, state=PresenceState.OFFLINE,
status_msg=None, status_msg=None,