Skip to content

Commit

Permalink
Merge pull request #518 from xmtp/np/sync-all-groups-perf
Browse files Browse the repository at this point in the history
Fix Android syncAllGroups performance issue
  • Loading branch information
nplasterer authored Oct 25, 2024
2 parents 8199e76 + c4f0d4e commit e1862c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,6 @@ class XMTPModule : Module() {
withContext(Dispatchers.IO) {
logV("syncAllGroups")
val client = clients[inboxId] ?: throw XMTPException("No client")
client.conversations.syncAllGroups()
// Expo Modules do not support UInt, so we need to convert to Int
val numGroupsSyncedInt: Int =
client.conversations.syncAllGroups()?.toInt() ?: throw IllegalArgumentException(
Expand Down
9 changes: 9 additions & 0 deletions example/src/tests/groupPerformanceTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ test('testing large group listings with ordering', async () => {
end = Date.now()
console.log(`Bo synced ${groups.length} groups in ${end - start}ms`)

start = Date.now()
await boClient.conversations.syncAllGroups()
end = Date.now()
console.log(`Bo synced all ${groups.length} groups in ${end - start}ms`)
assert(
end - start < 30000,
'Syncing all 1000 groups should take less than a 30 second'
)

start = Date.now()
groups = await boClient.conversations.listGroups()
end = Date.now()
Expand Down

0 comments on commit e1862c0

Please sign in to comment.