Ensure we never miss any presence updates
This commit is contained in:
parent
0126ef7f3c
commit
1783c7ca92
|
@ -858,6 +858,9 @@ 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
|
||||||
|
|
||||||
|
max_serial = presence._user_cachemap_latest_serial
|
||||||
|
|
||||||
clock = self.clock
|
clock = self.clock
|
||||||
latest_serial = 0
|
latest_serial = 0
|
||||||
|
|
||||||
|
@ -866,7 +869,7 @@ class PresenceEventSource(object):
|
||||||
for observed_user in cachemap.keys():
|
for observed_user in cachemap.keys():
|
||||||
cached = cachemap[observed_user]
|
cached = cachemap[observed_user]
|
||||||
|
|
||||||
if cached.serial <= from_key:
|
if cached.serial <= from_key or cached.serial > max_serial:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not (yield self.is_visible(observer_user, observed_user)):
|
if not (yield self.is_visible(observer_user, observed_user)):
|
||||||
|
@ -881,6 +884,9 @@ class PresenceEventSource(object):
|
||||||
if serial < from_key:
|
if serial < from_key:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if serial > max_serial:
|
||||||
|
continue
|
||||||
|
|
||||||
latest_serial = max(latest_serial, serial)
|
latest_serial = max(latest_serial, serial)
|
||||||
for u in user_ids:
|
for u in user_ids:
|
||||||
updates.append({
|
updates.append({
|
||||||
|
|
Loading…
Reference in New Issue