Skip to content

Commit

Permalink
Merge pull request matrix-org#2062 from matrix-org/erikj/presence_rep…
Browse files Browse the repository at this point in the history
…lication

Use presence replication stream to invalidate cache
  • Loading branch information
erikjohnston authored Mar 24, 2017
2 parents 31d56c3 + 987f494 commit 281553a
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.invalidate, (state.user_id,)
)

# Actually insert new rows
Expand Down

0 comments on commit 281553a

Please sign in to comment.