Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Stream of new messages does not emit all new messages #91

Open
bselwe opened this issue Oct 17, 2023 · 2 comments
Open

Bug: Stream of new messages does not emit all new messages #91

bselwe opened this issue Oct 17, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@bselwe
Copy link

bselwe commented Oct 17, 2023

Describe the bug

When the stream of messages streamBatchMessages is idle for 5-15 minutes (there is no new message received within that time), it sometimes fails to emit all new messages by skipping the first few messages.

CleanShot 2023-10-17 at 11 05 13@2x

Expected behavior

The stream of messages streamBatchMessages delivers all new messages in the given conversations.

Steps to reproduce the bug

listenToMessages(List<xmtp.Conversation> conversations) {
  recovery.cancel("messages");
  messagesSubscription?.cancel();
  messagesSubscription = client.streamBatchMessages(conversations).listen(
    (newMessage) async {
      debugPrint(
        '${DateTime.now()} [Conversations]: New message from ${newMessage.sender}: ${newMessage.content}',
      );

      send(NewMessageResponse(newMessage));
    },
    onError: (_) {
      recovery.cancel("messages");
      messagesSubscription?.cancel();
      recovery.attempt("messages", () => listenToMessages(conversations));
    },
  );
}

For recovery, see this.

@bselwe bselwe added the bug Something isn't working label Oct 17, 2023
@bselwe
Copy link
Author

bselwe commented Oct 19, 2023

I've noticed that streamBatchMessages quite often emits a GRPC error, which might be related:

gRPC Error (code: 4, codeName: DEADLINE_EXCEEDED, message: Deadline exceeded, details: null, rawResponse: null, trailers: {})

@humanagent humanagent self-assigned this Nov 4, 2023
@humanagent humanagent removed their assignment Dec 19, 2023
@giovasdistillery giovasdistillery self-assigned this Feb 22, 2024
@giovasdistillery
Copy link

@bselwe the whole day I tried to reproduce the error but I was not able to do it, the worst case scenario I can see is a lack of 3-4 minutes to get messages, but I received all messages, Could you please add more descriptive way to reproduce the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants