Faster member list by avoiding many FFI calls (#2322)
* Faster member list by avoiding many FFI calls
This commit is contained in:
parent
f2169aaaa8
commit
38cea8e68e
2 changed files with 3 additions and 1 deletions
1
changelog.d/2322.misc
Normal file
1
changelog.d/2322.misc
Normal file
|
|
@ -0,0 +1 @@
|
|||
Improve room member list loading times, increase chunk size
|
||||
|
|
@ -40,7 +40,7 @@ import kotlin.coroutines.coroutineContext
|
|||
internal class RoomMemberListFetcher(
|
||||
private val room: RoomInterface,
|
||||
private val dispatcher: CoroutineDispatcher,
|
||||
private val pageSize: Int = 1000,
|
||||
private val pageSize: Int = 10_000,
|
||||
) {
|
||||
private val updatedRoomMemberMutex = Mutex()
|
||||
private val roomId = room.id()
|
||||
|
|
@ -108,6 +108,7 @@ internal class RoomMemberListFetcher(
|
|||
// We should probably implement some sort of paging in the future.
|
||||
coroutineContext.ensureActive()
|
||||
val chunk = iterator.nextChunk(pageSize.toUInt())
|
||||
// Load next chunk. If null (no more items), exit the loop
|
||||
val members = chunk?.parallelMap(RoomMemberMapper::map) ?: break
|
||||
addAll(members)
|
||||
Timber.i("Emitting first $size members for room $roomId")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue