-
Notifications
You must be signed in to change notification settings - Fork 1
Fixing getTranscript loop on reconnection flow #57
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
Conversation
private suspend fun fetchTranscriptWith(startPosition: StartPosition?) { | ||
getTranscript(startPosition = startPosition, | ||
scanDirection = ScanDirection.FORWARD, | ||
sortKey = SortKey.ASCENDING, | ||
maxResults = 30, | ||
maxResults = 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what made us to increase the maxResults ? will not increase the response object size & latency ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will only return a larger object/latency if there are more messages, and if there are more messages, it would be better to have one API call vs. two smaller API calls.
Since this logic is to fetch messages that are missing during disconnection, we wouldn't want to retrieve only part of the missing messages.
cde4e15
Issue Number:
Description:
What are the changes? Why are we making them?
This PR fixes an unexpected getTranscript loop regarding the re-connection flow. The issue stems from an unexpected behavior where calling getTranscript in the forward direction will always return the last item and a nextToken even if there are no more messages.
This PR fixes this issue by changing the conditional to add another check to see whether the last returned message is already within the internal transcript. If it is, we already know that we have fetched all available messages.
Functional backward compatibility:
Does this change introduce backwards incompatible changes? [YES/NO]
NO
Does this change introduce any new dependency? [YES/NO]
NO
Testing:
Is the code unit tested?
YES
Have you tested the changes with a sample UI (e.g. Android Mobile Chat Example)?
List manual testing steps:
Here are a list of manual test cases to run through: