Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Eliminate unnecessary mark-and-sweep phases on a genuine first M3U import into an empty store, while preserving interrupted-import retry recovery and normal refresh pruning.
Root Cause
During a cold M3U import into an empty store, every row written was freshly inserted. Running 5 full mark-and-sweep phases (pruning live streams, movies, series, episodes, categories) walked every newly inserted record against seen ID sets only to delete 0 rows, consuming significant time and memory holding seen-sets until the end of the last sweep.
Changes
ContentSyncManager+Prune.swift): AddedplaylistHasExistingCatalogRows(playlistId:)with boundedfetchLimit: 1acrossLiveStream,Movie,Series, andEpisode. This avoids relying onplaylist.lastSyncDate, which isnileven after an interrupted/partial import.ContentSyncManager+M3UImportState.swift&+M3UFields.swift): Seededstate.hadExistingContent = !state.knownCategories.isEmpty || playlistHasExistingCatalogRows(playlistId: playlistId)before writes begin.ContentSyncManager+M3UPrune.swift): GuardedpruneStaleM3URows(playlistId:state:)onstate.hadExistingContent. Whenfalse, immediately clears seen-sets and returns without running sweeps.ContentSyncPruneTests.swift&M3USyncTests.swift):testReimportProviderShapedPlaylistinM3UColdImportBenchmarks.swift.Validation
ContentSyncPruneTests: 5/5 passed (0 failures).M3USyncTests: 12/12 passed (0 failures).