mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Fix perf regression in PR #3530
The get_entities_changed function was changed to return all changed entities since the given stream position, rather than only those changed from a given list of entities. This resulted in the function incorrectly returning large numbers of entities that, for example, caused large increases in database usage.
This commit is contained in:
parent
3fe0938b76
commit
547b1355d3
@ -74,12 +74,17 @@ class StreamChangeCache(object):
|
||||
assert type(stream_pos) is int
|
||||
|
||||
if stream_pos >= self._earliest_known_stream_pos:
|
||||
result = {
|
||||
changed_entities = {
|
||||
self._cache[k] for k in self._cache.islice(
|
||||
start=self._cache.bisect_right(stream_pos),
|
||||
)
|
||||
}
|
||||
|
||||
result = {
|
||||
e for e in entities
|
||||
if e in changed_entities
|
||||
}
|
||||
|
||||
self.metrics.inc_hits()
|
||||
else:
|
||||
result = set(entities)
|
||||
|
Loading…
Reference in New Issue
Block a user