Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Revert "Revert "Try to not use as much CPU in the StreamChangeCache"" (
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl authored Jun 28, 2018
1 parent cd6bcda commit 72d2143
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Empty file added changelog.d/3447.misc
Empty file.
6 changes: 4 additions & 2 deletions synapse/util/caches/stream_change_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def get_entities_changed(self, entities, stream_pos):
not_known_entities = set(entities) - set(self._entity_to_key)

result = (
set(self._cache.values()[self._cache.bisect_right(stream_pos) :])
{self._cache[k] for k in self._cache.islice(
start=self._cache.bisect_right(stream_pos))}
.intersection(entities)
.union(not_known_entities)
)
Expand Down Expand Up @@ -113,7 +114,8 @@ def get_all_entities_changed(self, stream_pos):
assert type(stream_pos) is int

if stream_pos >= self._earliest_known_stream_pos:
return self._cache.values()[self._cache.bisect_right(stream_pos) :]
return [self._cache[k] for k in self._cache.islice(
start=self._cache.bisect_right(stream_pos))]
else:
return None

Expand Down

0 comments on commit 72d2143

Please sign in to comment.