mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Performance : call roomFactory.destroy()
This commit is contained in:
+3
@@ -490,6 +490,9 @@ class RustMatrixClient(
|
|||||||
override fun roomDirectoryService(): RoomDirectoryService = roomDirectoryService
|
override fun roomDirectoryService(): RoomDirectoryService = roomDirectoryService
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
|
appCoroutineScope.launch {
|
||||||
|
roomFactory.destroy()
|
||||||
|
}
|
||||||
sessionCoroutineScope.cancel()
|
sessionCoroutineScope.cancel()
|
||||||
clientDelegateTaskHandle?.cancelAndDestroy()
|
clientDelegateTaskHandle?.cancelAndDestroy()
|
||||||
notificationSettingsService.destroy()
|
notificationSettingsService.destroy()
|
||||||
|
|||||||
+2
-1
@@ -31,6 +31,7 @@ import io.element.android.libraries.sessionstorage.api.SessionData
|
|||||||
import io.element.android.services.toolbox.api.systemclock.SystemClock
|
import io.element.android.services.toolbox.api.systemclock.SystemClock
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
|
import kotlinx.coroutines.NonCancellable
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
@@ -89,7 +90,7 @@ class RustRoomFactory(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun destroy() {
|
suspend fun destroy() {
|
||||||
withContext(dispatcher) {
|
withContext(NonCancellable + dispatcher) {
|
||||||
mutex.withLock {
|
mutex.withLock {
|
||||||
Timber.d("Destroying room factory")
|
Timber.d("Destroying room factory")
|
||||||
cache.evictAll()
|
cache.evictAll()
|
||||||
|
|||||||
Reference in New Issue
Block a user