mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-23 06:10:37 -04:00
Check the stream position before checking if the cache is empty. (#14639)
An empty cache does not mean the entity has no changed, if it is earlier than the earliest known stream position return that the entity *has* changed since the cache cannot accurately answer that query.
This commit is contained in:
parent
f3ad68c343
commit
da77720752
3 changed files with 10 additions and 7 deletions
|
@ -144,9 +144,10 @@ class StreamChangeCacheTests(unittest.HomeserverTestCase):
|
|||
"""
|
||||
cache = StreamChangeCache("#test", 1)
|
||||
|
||||
# With no entities, it returns False for the past, present, and future.
|
||||
self.assertFalse(cache.has_any_entity_changed(0))
|
||||
self.assertFalse(cache.has_any_entity_changed(1))
|
||||
# With no entities, it returns True for the past, present, and False for
|
||||
# the future.
|
||||
self.assertTrue(cache.has_any_entity_changed(0))
|
||||
self.assertTrue(cache.has_any_entity_changed(1))
|
||||
self.assertFalse(cache.has_any_entity_changed(2))
|
||||
|
||||
# We add an entity
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue