-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Wait for room stream change cache position #14269
Wait for room stream change cache position #14269
Conversation
802fde1
to
93c781c
Compare
44d74ff
to
dbebe7f
Compare
This appears to have previously been done within the room depth handling and only for local events.
dbebe7f
to
9b5ef68
Compare
assert event.internal_metadata.stream_ordering is not None | ||
self.store._events_stream_cache.entity_has_changed( | ||
event.room_id, event.internal_metadata.stream_ordering | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we do this at
self._events_stream_cache.entity_has_changed(room_id, stream_ordering) |
called from
self.store._invalidate_caches_for_event, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm we do indeed. Could it be the async event cache changes? Specifically has this addition opened a gap here because the await call will mean the invalidation isn't handled synchronously? Nevermind the ID generator advances the token in a after_txn
which always happens after the async callbacks so is safe.
I have reverted this change in 22d4ad1 leaving just the federated get_next
call in update_current_state
.
This is already handled as part of the invalidate caches for event callback.
Per discussion in #14158 this probably shouldn't be happening at all, but this change would at least log & address the issue pending any other fixes. |
Closing for now in favour of fixing the lefover races. |
Proposed fix for race conditions between room stream change caches and invalidation over replication (see: #14158).
NOTE: this PR originally applied the wait for on device lists/device inbox stream change caches, but ran into a bunch of issues with those so leaving for a separate PR, this just focusses on rooms/events.
Signed off by Nick @ Beeper (@Fizzadar).
Pull Request Checklist
(run the linters)