From 4a7e0a5d95c6dd6f3fbe18fe7f779be1a9dc40f5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 12 Oct 2021 11:57:07 +0200 Subject: [PATCH] CleanupSession: start by releasing the session, then empty the databases --- .../android/sdk/internal/session/cleanup/CleanupSession.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt index 113e0f218a..e8d3eb1a78 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cleanup/CleanupSession.kt @@ -61,6 +61,9 @@ internal class CleanupSession @Inject constructor( Timber.d("Cleanup: cancel pending works...") workManagerProvider.cancelAllWorks() + Timber.d("Cleanup: release session...") + sessionManager.releaseSession(sessionId) + Timber.d("Cleanup: clear session data...") clearSessionDataTask.execute(Unit) @@ -71,9 +74,6 @@ internal class CleanupSession @Inject constructor( realmKeysUtils.clear(SessionModule.getKeyAlias(userMd5)) realmKeysUtils.clear(CryptoModule.getKeyAlias(userMd5)) - Timber.d("Cleanup: release session...") - sessionManager.releaseSession(sessionId) - // Wait for all the Realm instance to be released properly. Closing Realm instance is async. // After that we can safely delete the Realm files waitRealmRelease()