File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
5959import kotlinx.coroutines.flow.StateFlow
6060import kotlinx.coroutines.flow.asStateFlow
6161import kotlinx.coroutines.withContext
62+ import kotlinx.coroutines.yield
6263import org.matrix.rustcomponents.sdk.RequiredState
6364import org.matrix.rustcomponents.sdk.Room
6465import org.matrix.rustcomponents.sdk.RoomListItem
@@ -192,20 +193,20 @@ class RustMatrixRoom(
192193 while (true ) {
193194 // Loading the whole membersIterator as a stop-gap measure.
194195 // We should probably implement some sort of paging in the future.
196+ yield ()
195197 addAll(membersIterator.nextChunk(1000u ) ? : break )
196198 }
197199 }
198200 }
199201 val mappedMembers = rustMembers.parallelMap(RoomMemberMapper ::map)
200202 _membersStateFlow .value = MatrixRoomMembersState .Ready (mappedMembers)
201203 Result .success(Unit )
204+ } catch (exception: CancellationException ) {
205+ _membersStateFlow .value = MatrixRoomMembersState .Error (prevRoomMembers = currentMembers, failure = exception)
206+ throw exception
202207 } catch (exception: Exception ) {
203208 _membersStateFlow .value = MatrixRoomMembersState .Error (prevRoomMembers = currentMembers, failure = exception)
204- if (exception is CancellationException ) {
205- throw exception
206- } else {
207- Result .failure(exception)
208- }
209+ Result .failure(exception)
209210 } finally {
210211 rustMembers?.destroyAll()
211212 }
You can’t perform that action at this time.
0 commit comments