diff options
author | Erik Johnston <erikj@jki.re> | 2017-03-15 17:37:15 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 17:37:15 +0000 |
commit | 54d2b7e596ffe330b8354d6ca78ee6ca6b7e6484 (patch) | |
tree | 922a54caf1885a43c2229fcd8a1ea66044a2d5e9 /synapse/handlers/presence.py | |
parent | Merge pull request #2013 from matrix-org/erikj/presence_FASTER (diff) | |
parent | Modify test_user_sync so it doesn't look at last_active_ts over last_user_syn... (diff) | |
download | synapse-54d2b7e596ffe330b8354d6ca78ee6ca6b7e6484.tar.xz |
Merge pull request #2014 from Half-Shot/hs/fix-appservice-presence
Add fallback to last_active_ts if it beats the last sync time on a presence timeout.
Diffstat (limited to 'synapse/handlers/presence.py')
-rw-r--r-- | synapse/handlers/presence.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 9cc94287b3..e562a2e87a 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -1174,7 +1174,10 @@ def handle_timeout(state, is_mine, syncing_user_ids, now): # If there are have been no sync for a while (and none ongoing), # set presence to offline if user_id not in syncing_user_ids: - if now - state.last_user_sync_ts > SYNC_ONLINE_TIMEOUT: + # If the user has done something recently but hasn't synced, + # don't set them as offline. + 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=PresenceState.OFFLINE, status_msg=None, |