Conversation
…rchived episodes during Up Next synchronization
|
Thanks! I think this would fix a lot of the reports but I think it introduces an issue where the local archived state could be stale. This is probably a lot less common that the normal Up Next → Archived state, though.
It seems like given enough refreshes the queues do converge again, though, and those archived episodes are added back. Maybe this is better than older archived episodes coming back? I wondered if this could be fixed by changing our sync ordering and running |
|
@yaelirub I think we can close this if that's alright with you. If we find we continue to get complaints or our quality project doesn't cover this, maybe we can introduce this with some safeguards like checking |
|
My suggestion if we want to keep this would be to Feature Flag it and also check that if FeatureFlag.skipArchivedEpisodesInUpNextSync.enabled,
let episode = localEpisode as? Episode,
episode.archived,
isArchiveDataFresh() {
FileLog.shared.addMessage("UpNextSyncTask: Episode \(localEpisode.displayableTitle()) is archived, skipping")
continue
}private func isArchiveDataFresh() -> Bool {
guard let lastSyncTime = ServerSettings.lastSyncTime else {
FileLog.shared.addMessage("UpNextSyncTask: No last sync time, archive data not considered fresh")
return false
}
let timeSinceLastSync = abs(lastSyncTime.timeIntervalSinceNow)
let isFresh = timeSinceLastSync < Self.archiveFreshnessThreshold
if !isFresh {
FileLog.shared.addMessage("UpNextSyncTask: Archive data is stale (last sync \(Int(timeSinceLastSync))s ago), not skipping archived episodes")
}
return isFresh
} |
|
Version |
|
Version |
|
Version |
Fixes PCIOS-203
The Problem
The issue occurs during Up Next synchronization between devices. Here's what's happening:
From the logs:
In /Modules/Server/Sources/PocketCastsServer/Public/Sync/UpNextSyncTask.swift:206-212, when incoming episodes from the server are not found in the local Up Next queue, the code never checks if localEpisode.archived == true before adding it back to Up Next.
Later, in podcasts/DownloadManager.swift:476-487, when episodes are queued for download, the system detects they're archived and un-archives them.
The logs show WatchManager: Unknown message type: downloadRequest shortly before syncs. When users interact with their Watch, it triggers:
The Fix
The UpNextSyncTask should check if an episode is archived before re-adding it to the queue. At line 207 in UpNextSyncTask.swift, add an archived status check:
To test
Not sure if we were ever able to reproduce this issue consistently. @Automattic/pocket-casts-ios , any idea how to test if this fix makes sense?
Checklist
CHANGELOG.mdif necessary.