Performance : call roomFactory.destroy()
This commit is contained in:
parent
dc36634f1c
commit
303f46852a
2 changed files with 5 additions and 1 deletions
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue