Improve logs.
This commit is contained in:
parent
a9720e36c1
commit
c0d2de26db
3 changed files with 6 additions and 3 deletions
|
|
@ -54,10 +54,12 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService:
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun restore(state: SavedStateMap?) {
|
fun restore(state: SavedStateMap?) {
|
||||||
|
Timber.d("Restore state")
|
||||||
if (state == null || sessionIdsToMatrixClient.isNotEmpty()) return Unit.also {
|
if (state == null || sessionIdsToMatrixClient.isNotEmpty()) return Unit.also {
|
||||||
Timber.w("Restore with non-empty map")
|
Timber.w("Restore with non-empty map")
|
||||||
}
|
}
|
||||||
val sessionIds = state[SAVE_INSTANCE_KEY] as? Array<SessionId>
|
val sessionIds = state[SAVE_INSTANCE_KEY] as? Array<SessionId>
|
||||||
|
Timber.d("Restore matrix session keys = ${sessionIds?.map { it.value }}")
|
||||||
if (sessionIds.isNullOrEmpty()) return
|
if (sessionIds.isNullOrEmpty()) return
|
||||||
// Not ideal but should only happens in case of process recreation. This ensure we restore all the active sessions before restoring the node graphs.
|
// Not ideal but should only happens in case of process recreation. This ensure we restore all the active sessions before restoring the node graphs.
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
|
@ -76,7 +78,7 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService:
|
||||||
|
|
||||||
fun save(state: MutableSavedStateMap) {
|
fun save(state: MutableSavedStateMap) {
|
||||||
val sessionKeys = sessionIdsToMatrixClient.keys.toTypedArray()
|
val sessionKeys = sessionIdsToMatrixClient.keys.toTypedArray()
|
||||||
Timber.d("Save matrix session keys = $sessionKeys")
|
Timber.d("Save matrix session keys = ${sessionKeys.map { it.value }}")
|
||||||
state[SAVE_INSTANCE_KEY] = sessionKeys
|
state[SAVE_INSTANCE_KEY] = sessionKeys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,13 @@ interface RoomSummaryDataSource {
|
||||||
|
|
||||||
suspend fun RoomSummaryDataSource.awaitAllRoomsAreLoaded(timeout: Duration = Duration.INFINITE) {
|
suspend fun RoomSummaryDataSource.awaitAllRoomsAreLoaded(timeout: Duration = Duration.INFINITE) {
|
||||||
try {
|
try {
|
||||||
|
Timber.d("awaitAllRoomsAreLoaded: wait")
|
||||||
withTimeout(timeout) {
|
withTimeout(timeout) {
|
||||||
allRoomsLoadingState().firstOrNull {
|
allRoomsLoadingState().firstOrNull {
|
||||||
it is RoomSummaryDataSource.LoadingState.Loaded
|
it is RoomSummaryDataSource.LoadingState.Loaded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (timeoutException: TimeoutCancellationException) {
|
} catch (timeoutException: TimeoutCancellationException) {
|
||||||
Timber.v("AwaitAllRooms: no response after $timeout")
|
Timber.d("awaitAllRoomsAreLoaded: no response after $timeout")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ fun RoomListService.roomOrNull(roomId: String): RoomListItem? {
|
||||||
return try {
|
return try {
|
||||||
room(roomId)
|
room(roomId)
|
||||||
} catch (exception: RoomListException) {
|
} catch (exception: RoomListException) {
|
||||||
Timber.e(exception, "Failed finding room with id=$roomId")
|
Timber.d(exception, "Failed finding room with id=$roomId.")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue