Performance : call roomFactory.destroy()

This commit is contained in:
ganfra
2024-07-17 17:23:15 +02:00
parent dc36634f1c
commit 303f46852a
2 changed files with 5 additions and 1 deletions

View File

@@ -490,6 +490,9 @@ class RustMatrixClient(
override fun roomDirectoryService(): RoomDirectoryService = roomDirectoryService
override fun close() {
appCoroutineScope.launch {
roomFactory.destroy()
}
sessionCoroutineScope.cancel()
clientDelegateTaskHandle?.cancelAndDestroy()
notificationSettingsService.destroy()

View File

@@ -31,6 +31,7 @@ import io.element.android.libraries.sessionstorage.api.SessionData
import io.element.android.services.toolbox.api.systemclock.SystemClock
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
@@ -89,7 +90,7 @@ class RustRoomFactory(
}
suspend fun destroy() {
withContext(dispatcher) {
withContext(NonCancellable + dispatcher) {
mutex.withLock {
Timber.d("Destroying room factory")
cache.evictAll()