mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-07 19:21:32 -07:00
fix(subtitles): release prefetch pause across all priming paths
The repeated-subtitle pause leak was only fixed for ordinary subtitle changes. Startup autoplay priming and visible-overlay priming pause the same way and also ignored whether any tokenization was scheduled, so a cache miss on text the controller already holds (mining a card while the line is on screen) left prefetching idle for the rest of the cue. Pause and release are now one operation via pausePrefetchUntilEmit, and both controller entry points report whether an emit is expected. A repeat arriving while a run is already in flight keeps the pause, since that run still emits. Also invalidate the character dictionary lookups centrally from the sync completion handler instead of at three manager call sites. Ordinary selection sync never invalidated them, so a stale non-null name candidate list could skip a newly added name for up to five seconds; a missing list falls back to the exhaustive scan, but a stale one does not. Ordering matters: the invalidation runs before the subtitle refreshes so they re-tokenize against the new dictionary content. Docs: subtitle-overlay-priming no longer claims every subtitle change calls onSeek().
This commit is contained in:
@@ -7,6 +7,12 @@ export function handleCharacterDictionaryAutoSyncComplete(
|
||||
deps: {
|
||||
hasParserWindow: () => boolean;
|
||||
clearParserCaches: () => void;
|
||||
/**
|
||||
* Drops cached reads of the generated dictionary (character images, and the
|
||||
* name candidates the scanner uses to skip lookups). Runs before the
|
||||
* refreshes below so they re-tokenize against the new dictionary content.
|
||||
*/
|
||||
invalidateCharacterDictionaryLookups?: () => void;
|
||||
invalidateTokenizationCache: () => void;
|
||||
refreshSubtitlePrefetch: () => void;
|
||||
refreshCurrentSubtitle: () => void;
|
||||
@@ -14,6 +20,7 @@ export function handleCharacterDictionaryAutoSyncComplete(
|
||||
},
|
||||
): void {
|
||||
if (completion.changed) {
|
||||
deps.invalidateCharacterDictionaryLookups?.();
|
||||
if (deps.hasParserWindow()) {
|
||||
deps.clearParserCaches();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user