fix(sqlite): Empty the cache after the introduction of TimelineEvent::timestamp
#5665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After the merge of #5648, we want all events to get a
TimelineEvent::timestampvalue (extracted fromorigin_server_ts).To accomplish that, we are emptying the event cache. New synced events will be built correctly, with a valid
TimelineEvent::timestamp, allowing a clear, stable situation.This is required to also solve a performance problem. When using the new
room_list_service::sorter::recency, theTimelineEvent::timestamp()method is called a lot (depending of the number of rooms). If theTimelineEvent::timestampfield is empty (None),extract_timestampwill be called to… extract the timestamp from theorigin_server_tsvalue, which implies parsing the event every time. This value isn't kept in-memory at this step becauseTimelineEvent::timestamp()is a getter. Thetimestampvalue is set during the sync. Hence the clearing of the cache: we restart from fresh, and we are sure all events will have a correcttimestampvalue.