Automattic / Automattic/pocket-casts-android

Issue with timing of Up Next sync

Open
#67 4 comments 0 reactions 0 assignees View on GitHub
[Area] Sync [Type] Enhancement Migrated
Dominant language
Kotlin
Stars
2.8k
Forks
308
Avg merge
1d 10h
Merged PRs (30d)
187

Description

Up Next syncing is set to happen 5 seconds after the last change to Up Next was made. There might be a timing issue here though in that if you make more changes to the Up Next list while the previous changes have already been sent to the server, but before a response comes back you can end up in a slightly inconsistent state, eg:
So:
1. Add 3 things to Up Next
2. Up Next sync task starts, with those changes, but hasn't received a response yet
3. Remove 1 of the episodes added from Up Next
4. Up Next task gets a response, that there should be 3 things in Up Next, so it makes that change
5. Now the thing you removed is back in Up Next

Note that it's possible that the next time an Up Next sync runs, the remove will get sent and then this will fix itself. Adding this issue so we can do more detailed testing, for example putting a long sleep in between getting the server data and processing it to test if we can mess things up.

Contributor guide

Open the contributing guide

Research direction

Start with the Up Next sync task and trace how changes are sent, server responses are received, and those responses are applied. Reproduce the sequence in the issue, inserting a long delay between receiving server data and processing it. Done means a removal made while an earlier sync is awaiting a response is not restored by that response, and detailed tests cover the race.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.