Skip to content

Commit

Permalink
Use presence replication stream to invalidate cache
Browse files Browse the repository at this point in the history
Instead of using the cache invalidation replication stream to invalidate
the _get_presence_cache, we can instead rely on the presence replication
stream. This reduces the amount of replication traffic considerably.
  • Loading branch information
erikjohnston committed Mar 24, 2017
1 parent 48e7697 commit 09f79aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions synapse/replication/slave/storage/presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ def process_replication(self, result):
self.presence_stream_cache.entity_has_changed(
user_id, position
)
self._get_presence_for_user.invalidate((user_id,))

return super(SlavedPresenceStore, self).process_replication(result)
4 changes: 2 additions & 2 deletions synapse/storage/presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def _update_presence_txn(self, txn, stream_orderings, presence_states):
self.presence_stream_cache.entity_has_changed,
state.user_id, stream_id,
)
self._invalidate_cache_and_stream(
txn, self._get_presence_for_user, (state.user_id,)
txn.call_after(
self._get_presence_for_user, (state.user_id,)
)

# Actually insert new rows
Expand Down

0 comments on commit 09f79aa

Please sign in to comment.