Ensure the serial returned by presence is always an integer
This commit is contained in:
parent
9fbcf19188
commit
d98edb548a
|
@ -859,7 +859,7 @@ class PresenceEventSource(object):
|
||||||
presence = self.hs.get_handlers().presence_handler
|
presence = self.hs.get_handlers().presence_handler
|
||||||
cachemap = presence._user_cachemap
|
cachemap = presence._user_cachemap
|
||||||
clock = self.clock
|
clock = self.clock
|
||||||
latest_serial = None
|
latest_serial = 0
|
||||||
|
|
||||||
updates = []
|
updates = []
|
||||||
# TODO(paul): use a DeferredList ? How to limit concurrency.
|
# 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)):
|
if not (yield self.is_visible(observer_user, observed_user)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if latest_serial is None or cached.serial > latest_serial:
|
latest_serial = max(cached.serial, latest_serial)
|
||||||
latest_serial = cached.serial
|
|
||||||
updates.append(cached.make_event(user=observed_user, clock=clock))
|
updates.append(cached.make_event(user=observed_user, clock=clock))
|
||||||
|
|
||||||
# TODO(paul): limit
|
# TODO(paul): limit
|
||||||
|
@ -882,6 +881,7 @@ class PresenceEventSource(object):
|
||||||
if serial < from_key:
|
if serial < from_key:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
latest_serial = max(cached.serial, serial)
|
||||||
for u in user_ids:
|
for u in user_ids:
|
||||||
updates.append({
|
updates.append({
|
||||||
"type": "m.presence",
|
"type": "m.presence",
|
||||||
|
|
Loading…
Reference in New Issue