-
Notifications
You must be signed in to change notification settings - Fork 226
Ensure that we have only one single instance of SeenInviteStore per session #4577
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
…ession. Fixes #4558 Fix crash: java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/io.element.android.x/files/datastore/session_0ebb139587b6d940_seen-invites.preferences_pb. You should either maintain your DataStore as a singleton or confirm that there is no two DataStore's active on the same file (by confirming that the scope is cancelled).
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4577 +/- ##
===========================================
- Coverage 80.08% 80.06% -0.02%
===========================================
Files 2087 2089 +2
Lines 55121 55134 +13
Branches 6876 6876
===========================================
Hits 44144 44144
- Misses 8617 8630 +13
Partials 2360 2360 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Thanks I can confirm it fixes the issue for me!
private val seenInvitesStore = seenInvitesStoreFactory.getOrCreate( | ||
sessionId = client.sessionId, | ||
sessionCoroutineScope = client.sessionCoroutineScope, | ||
) |
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.
I don't mind using this, but I think you could also create a @Provides
method for SessionScope
that would return the cached store if needed:
@Provides
fun providesSeenInvitesStore(factory: SeenInvitesStoreFactory, sessionId: SessionId, @SessionCoroutineScope sessionCoroutineScope: CoroutineScope) {
return factory.getOrCreate(sessionId, sesionCoroutineScope)
}
And then you can just inject the result in the session scope.
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.
Ah that's a bit cleaner, will give it a try
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.
|
Content
Ensure that we have only one single instance of SeenInviteStore per session by using a SeenInviteStoreFactory.
Motivation and context
Fix crash:
java.lang.IllegalStateException: There are multiple DataStores active for the same file: /data/user/0/io.element.android.x/files/datastore/session_0ebb139587b6d940_seen-invites.preferences_pb. You should either maintain your DataStore as a singleton or confirm that there is no two DataStore's active on the same file (by confirming that the scope is cancelled).
Fixes #4559
Screenshots / GIFs
Tests
Tested devices
Checklist