fix: sync failing when trying to update unknown user [WPB-4805] #2078
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
The user is "stuck in connecting" after another user was added and removed from the team while he/she was offline.
Causes (Optional)
The app is stuck, because, while being offline, the other user was added and removed from the team we are in, so when we are back online, we receive
team.memberjoin
,user.update
and only thenteam.memberleave
. At the time we handle first one, the user is no longer in the team, so we get404
when fetching user data and this user is not added to our local db. We ignore errors for team-specific events so it moves to handling the next one, which isuser.update
and again - we can’t handle it because we can’t update the user that’s not in our local db, but this time it results in a sync failure.lastProcessedEventId
is not being updated because of this failure so it loops indefinitely when we retry the sync, because we try to handle the same event again.Solutions
If the user that we want to update is not found in the local db, it means that this user is not in my team, is not my contact nor member of any of groups that I'm in. This means, that we can just safely ignore this event and move on to handle next ones without a failure.
Testing
Test Coverage (Optional)
How to Test
STR:
user.update
event)PR Post Submission Checklist for internal contributors (Optional)
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.