Sync mechanism #189
Replies: 3 comments 1 reply
-
|
Thanks @Sporiff for starting this discussion. To begin with a key question:
For me this is clear: it is user-based. The user must be central, and is assumed to have multiple devices on which they listen and do other actions. And I think we concluded this already before - gpodder.net seems more device-focussed, in its UX at least. |
Beta Was this translation helpful? Give feedback.
-
|
Creating a separate sub-thread for another key point:
I can't comment on this, really. No idea what the benefits and downsides are of either. (From the APIs that I've consumed the per-entity endpoint seems kind of standard, but that's hardly an argument.) |
Beta Was this translation helpful? Give feedback.
-
|
Now, a separate sub-thread on authoritativeness, looking at episodes particularly as there's the highest chance on drift:
So far our approach has been this:
Our argumentation has been: we expect the client to record timestamp of when a change occurred, and submit those real timestamps -- not the timestamp of submitting this change.
Is that really a practical risk nowadays?
In light of the above, such versioning system seems unnecessary added complexity for clients to implement. It would require additional database columns (which has an impact on app size for AntennaPod, even if the columns are empty). And it would require agreements on what exactly constitutes a version jump. If there's drift or issues with syncing, the user will report to the server or client maintainer, who can then investigate it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Right, I know you're all probably sick of the back and forth on this, so I thought I'd open this up as a discussion here so that we can keep everything together.
Through my various experiments and trials, it's become apparent that the sync mechanism is the hard problem to solve here, and it largely comes down to two things:
entity_typeandactionor per-entity sync?Subscriptions sync
My current thinking around subscriptions is, to summarize:
For this kind of thing, a single sync endpoint that keeps track of actions is trivial enough, for example:
[ { "event_id": "6217f6e5-9bd5-4fc7-bd8c-8d0dea32d082", "action": "create", "action_timestamp": "2026-07-05T14:00:45+00:00", "entity_type": "subscription", "data": { "feed_url": "https://example.com/rss1", "guid": "63bdca44-e177-4b0c-8307-42e653b0ce54", "subscribed_at": "2023-07-04T08:23:13+00:00", "unsubscribed_at": "2026-07-03T12:20:14+00:00", } } ]We could make a required heading for client IDs (
X-Client-ID) so that clients don't receive their own updates when they sync by default, then have a param they can pass if they want to see everything.Episodes sync
Episodes have one real sticking point in my mind: authority over changes. We can look at this a few ways:
From this, it strikes me that we need to have some sort of versioning capability (optimistic concurrency model), where the server responds with the latest version of an entity. To give a simple example:
When the client receives these data from the server, it must then refer to the latest version that it's aware of when it wants to perform an update. For example:
If the server receives this, and the version has since incremented, this is a mismatch. The client then needs to essentially "rebase" on top of the latest change, and then send it back with an updated expectation.
To summarize: I'm trying to think of ways that we can avoid having too many conflicts. As I said above, I think subscriptions are unlikely to give too many issues here, but users will likely update episodes a lot more.
I want to hear opinions, alternatives, feedback, technical challenges. Whatever you've got, basically. Working this out would basically unblock us, I feel.
Beta Was this translation helpful? Give feedback.
All reactions