xmtp / xmtp-react-native

A package you can use to build with XMTP in a React Native or Expo app.
MIT License
35 stars 14 forks source link

Bug: Stream groups does not get callback when streaming all messages #427

Closed alexrisch closed 1 week ago

alexrisch commented 2 weeks ago

Describe the bug

When having both a streamAllMessages (or similar variant) and streamGroups (or similar variant) the streamGroups does not get a callback

Expected behavior

Expect the test case to pass successfully

Steps to reproduce the bug

Simplified Test case:

  let groupCallbacks = 0
  let messageCallbacks = 0
  const [alix, bo] = await createClients(2)
  await Promise.all([
    bo.conversations.streamGroups(async () => {
      groupCallbacks++
    }),
    bo.conversations.streamAllGroupMessages(async () => {
      messageCallbacks++
    }),
  ])

  const group = await alix.conversations.newGroup([bo.address])
  await group.send('Hello')
  await delayToPropogate(10000)

  assert(
    groupCallbacks === 1,
    `group stream should have received 1 group but received ${groupCallbacks}`
  )
  assert(
    messageCallbacks === 1,
    `message stream should have received 1 message but received ${messageCallbacks}`
  )

Test case uses streamGroups & streamAllGroupMessages, but see the same when mixing streamAll and streamAllMessages

cameronvoell commented 1 week ago

Looks like we got a partial fix with PR here, but still seeing db locking errors when the libxmtp repro still sometimes fails https://github.com/xmtp/libxmtp/pull/855