diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-08-18 01:08:45 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-18 01:08:45 +1000 |
commit | c334ca67bb89039b3a00b7c9a1ce610e99859653 (patch) | |
tree | bc70fc575b225a0cd25694bbd371f3c78bea3b43 /synapse/app/synchrotron.py | |
parent | Remove v1/register's broken shared secret functionality (#3703) (diff) | |
download | synapse-c334ca67bb89039b3a00b7c9a1ce610e99859653.tar.xz |
Integrate presence from hotfixes (#3694)
Diffstat (limited to 'synapse/app/synchrotron.py')
-rw-r--r-- | synapse/app/synchrotron.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py index e201f18efd..cade09d60e 100644 --- a/synapse/app/synchrotron.py +++ b/synapse/app/synchrotron.py @@ -114,7 +114,10 @@ class SynchrotronPresence(object): logger.info("Presence process_id is %r", self.process_id) def send_user_sync(self, user_id, is_syncing, last_sync_ms): - self.hs.get_tcp_replication().send_user_sync(user_id, is_syncing, last_sync_ms) + if self.hs.config.use_presence: + self.hs.get_tcp_replication().send_user_sync( + user_id, is_syncing, last_sync_ms + ) def mark_as_coming_online(self, user_id): """A user has started syncing. Send a UserSync to the master, unless they @@ -211,10 +214,13 @@ class SynchrotronPresence(object): yield self.notify_from_replication(states, stream_id) def get_currently_syncing_users(self): - return [ - user_id for user_id, count in iteritems(self.user_to_num_current_syncs) - if count > 0 - ] + if self.hs.config.use_presence: + return [ + user_id for user_id, count in iteritems(self.user_to_num_current_syncs) + if count > 0 + ] + else: + return set() class SynchrotronTyping(object): |