mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-17 15:49:19 -04:00
Change the way we figure out presence updates for small deltas
This commit is contained in:
parent
02e928cf9b
commit
c77dae7a1a
2 changed files with 52 additions and 17 deletions
|
@ -85,6 +85,22 @@ class StreamChangeCache(object):
|
|||
|
||||
return result
|
||||
|
||||
def get_all_entities_changed(self, stream_pos):
|
||||
"""Returns all entites that have had new things since the given
|
||||
position. If the position is too old it will return None.
|
||||
"""
|
||||
assert type(stream_pos) is int
|
||||
|
||||
if stream_pos >= self._earliest_known_stream_pos:
|
||||
keys = self._cache.keys()
|
||||
i = keys.bisect_right(stream_pos)
|
||||
|
||||
return (
|
||||
self._cache[k] for k in keys[i:]
|
||||
)
|
||||
else:
|
||||
return None
|
||||
|
||||
def entity_has_changed(self, entity, stream_pos):
|
||||
"""Informs the cache that the entity has been changed at the given
|
||||
position.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue