Skip to content
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

fix(jvm): support logout and login when using in-memory storage #2274

Conversation

vitorhugods
Copy link
Member


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

When using inMemoryStorage for JVM, it's impossible to logout and then login again, as a new instance will be created from scratch, even when using SELF_SOFT_LOGOUT LogoutReason.

Solutions

Introduced the InMemoryDatabaseCache to hold a database across logins/logouts without losing the data.
If nuke is called, this cache will be cleared too. Which should only happen when there's a hard logout.

Make sure we also clear the cache when running unit tests.


PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

Updated the logic and structure for handling file-related operations in storageData. Added Support for both file-backed and in-memory databases in the userDatabaseBuilder. Also introduced the InMemoryDatabaseCache to hold a database across logins/ logouts without losing the data.
Copy link
Contributor

github-actions bot commented Nov 29, 2023

Unit Test Results

   394 files   -   85     394 suites   - 85   23s ⏱️ - 2m 14s
2 297 tests  - 374  2 231 ✔️  - 336  66 💤  - 38  0 ±0 

Results for commit 00928fa. ± Comparison against base commit 71fd11e.

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Nov 29, 2023

Datadog Report

All test runs 912ca38 🔗

2 Total Test Services: 0 Failed, 0 with New Flaky, 2 Passed

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Wall Time Branch View
kalium-ios 0 0 0 2231 66 6m 53.1s Link
kalium-jvm 0 0 0 2567 104 7m 10.04s Link

@codecov-commenter
Copy link

Codecov Report

Merging #2274 (00928fa) into develop (71fd11e) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2274      +/-   ##
=============================================
- Coverage      58.08%   58.08%   -0.01%     
  Complexity        21       21              
=============================================
  Files           1086     1087       +1     
  Lines          41144    41147       +3     
  Branches        3808     3808              
=============================================
+ Hits           23898    23899       +1     
- Misses         15618    15619       +1     
- Partials        1628     1629       +1     
Files Coverage Δ
...ire/kalium/persistence/db/InMemoryDatabaseCache.kt 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71fd11e...00928fa. Read the comment docs.

@vitorhugods vitorhugods added this pull request to the merge queue Nov 29, 2023
Merged via the queue into develop with commit 7600fa8 Nov 29, 2023
17 checks passed
@vitorhugods vitorhugods deleted the fix/jvm/support-logout-and-login-when-using-in-memory-storage branch November 29, 2023 02:11
augustocdias pushed a commit that referenced this pull request Dec 5, 2023
* fix(jvm): support logout and login when using in-memory storage

Updated the logic and structure for handling file-related operations in storageData. Added Support for both file-backed and in-memory databases in the userDatabaseBuilder. Also introduced the InMemoryDatabaseCache to hold a database across logins/ logouts without losing the data.

* style: unify inMemoryDatabase cleaning

* style: remove duplicate blank line

* chore: fix missing constructor call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants