fix(notifications): use last event instead of oldest when recoverying from 404 [WPB-267] #2039
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.
Cherry pick from the original PR:
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
When attempting to fetch the oldest possible event from the api, some issue prevents us from moving on. See WPB-4442.
We leave open a time gap between registering client and performing slow-sync until we first fetch the last notification from the backend. Which can lead to some events being lost.
Solutions
Move the responsibility of fetching the last notification from remote outside of the repository, and into slow sync. That now fetches and saves the most recent event IDs after successful workflow if there's no previously processed event ID.
This follows more closely the general sync documentation.
During incremental sync recovery, clears the last processed event ID and restarts slow sync for Client or EventNotFound failures. Which, as described in 1, will cause the fetching of the last remote event.
Refactored method names to align with these changes for better clarity.
Testing
Tested manually by changing the
lastProcessedEventId
in the database to some garbage, which led to a 404 and successful recovery.Test Coverage
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.