Skip to content

Make sure the live timeline is destroyed before clearing a room's cache #4515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jmartinesp
Copy link
Member

Content

  • Destroy live timeline instantiated right before clearing the room's cache. In a future refactor we should avoid creating the timeline at all, but at the moment this is the best we can do.
  • Destroy all room references before evicting them from the LRU cache when destroying RustMatrixClient on logout / clear cache. This should also destroy their live timelines.

Motivation and context

According to the SDK team, having a live timeline while clearing the cache could lead to DB issues.

Tests

Clear the cache from the developer settings or the room's context menu. If it still works as expected, the change didn't cause new issues, and should improve existing ones.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

According to the SDK team, having a live timeline could lead to DB issues.
…ctory` is destroyed

It may also have some effect on DB corruption issues we've seen
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Apr 1, 2025
@jmartinesp jmartinesp requested a review from a team as a code owner April 1, 2025 14:42
@jmartinesp jmartinesp requested review from ganfra and removed request for a team April 1, 2025 14:42
Copy link

sonarqubecloud bot commented Apr 1, 2025

Copy link
Contributor

github-actions bot commented Apr 1, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/JvnciA

Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 80.11%. Comparing base (3bff64b) to head (d1298f3).
Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
...roid/libraries/matrix/impl/room/RustRoomFactory.kt 0.00% 4 Missing ⚠️
...ndroid/features/roomlist/impl/RoomListPresenter.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4515      +/-   ##
===========================================
- Coverage    80.11%   80.11%   -0.01%     
===========================================
  Files         2081     2081              
  Lines        55768    55773       +5     
  Branches      6826     6826              
===========================================
  Hits         44681    44681              
- Misses        8744     8749       +5     
  Partials      2343     2343              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks!

@jmartinesp jmartinesp merged commit b2791d5 into develop Apr 2, 2025
34 of 36 checks passed
@jmartinesp jmartinesp deleted the fix/make-sure-live-timeline-is-destroyed-before-clearing-room-cache branch April 2, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants