mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-16 15:01:23 +01:00
Fix has_any_entity_changed
Occaisonally has_any_entity_changed would throw the error: "Set changed size during iteration" when taking the max of the `sorteddict`. While its uncertain how that happens, its quite inefficient to iterate over the entire dict anyway so we change to using the more traditional `bisect_*` functions.
This commit is contained in:
parent
98bdb4468b
commit
eed59dcc1e
1 changed files with 4 additions and 4 deletions
|
@ -96,10 +96,10 @@ class StreamChangeCache(object):
|
||||||
|
|
||||||
if stream_pos >= self._earliest_known_stream_pos:
|
if stream_pos >= self._earliest_known_stream_pos:
|
||||||
self.metrics.inc_hits()
|
self.metrics.inc_hits()
|
||||||
if stream_pos >= max(self._cache):
|
keys = self._cache.keys()
|
||||||
return False
|
i = keys.bisect_right(stream_pos)
|
||||||
else:
|
|
||||||
return True
|
return len(keys[i:]) > 0
|
||||||
else:
|
else:
|
||||||
self.metrics.inc_misses()
|
self.metrics.inc_misses()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue