diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-28 17:20:32 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-28 17:20:32 +0100 |
commit | d98edb548af8833a7c44eded610a528e3d0515c6 (patch) | |
tree | af22607504ea692f1771e3205b1d0c8e0fdb026e /synapse/handlers | |
parent | Merge pull request #123 from matrix-org/postgres (diff) | |
download | synapse-d98edb548af8833a7c44eded610a528e3d0515c6.tar.xz |
Ensure the serial returned by presence is always an integer
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/presence.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 571eacd343..774df46aba 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -859,7 +859,7 @@ class PresenceEventSource(object): presence = self.hs.get_handlers().presence_handler cachemap = presence._user_cachemap clock = self.clock - latest_serial = None + latest_serial = 0 updates = [] # TODO(paul): use a DeferredList ? How to limit concurrency. @@ -872,8 +872,7 @@ class PresenceEventSource(object): if not (yield self.is_visible(observer_user, observed_user)): continue - if latest_serial is None or cached.serial > latest_serial: - latest_serial = cached.serial + latest_serial = max(cached.serial, latest_serial) updates.append(cached.make_event(user=observed_user, clock=clock)) # TODO(paul): limit @@ -882,6 +881,7 @@ class PresenceEventSource(object): if serial < from_key: break + latest_serial = max(cached.serial, serial) for u in user_ids: updates.append({ "type": "m.presence", |