2 months ago
87b2055- get_or_create now only calls evict_if_needed when creating a new entry. A verified hit is already counted in the catalog, so evicting for it double-counted the size and could delete the very entry being reused when the cache was near its budget. - ensure_remote_file_cached now has a fallback fast-path that checks destination existence + size match when no catalog row exists. The catalog lookup only succeeds when a remote_cache_entries row exists, but atomic_download never creates one. Without this fallback, non- streaming remote media, CDG graphics, and imported remote files were re-downloaded on every access. - spawn_fetch_thread_with_fetcher now accepts an optional on_range_written callback that is invoked after each successful range write. The streaming playback path passes a callback that calls CacheCatalog::persist_ranges, so downloaded_ranges_json and complete are updated in real time. Without this, the catalog never recorded download progress, so cached remote audio was re-downloaded after restart and completed-entry verification never ran.
Parent3c58375