v0.4.18: fix /videoCache clear vs in-flight download race
Some checks failed
build / build (push) Has been cancelled
Some checks failed
build / build (push) Has been cancelled
clearAll() previously only wiped finalized files + the IN_FLIGHT set; any download that was already running on the single-thread executor kept writing past the clear, then atomically moved its .part to final and re-published into READY — resurrecting one cache entry post-clear. Fix: add an AtomicLong CACHE_EPOCH. preload() captures the epoch at submit time; clearAll() bumps the epoch BEFORE wiping disk; download(url, epoch) checks at three points (pre-start, in read loop, pre-publish) and bails if the epoch moved, deleting its own .part only AFTER closing the output stream (Windows can't delete an open file). Phase ordering in clearAll() also matters: bump epoch first → drop indexes → delete files. That way the in-flight download sees the cancellation flag before the index wipe / file delete races can interact with it.
This commit is contained in:
@@ -5,7 +5,7 @@ org.gradle.configuration-cache=false
|
||||
|
||||
# Mod
|
||||
mod_id=video_player
|
||||
mod_version=0.4.17
|
||||
mod_version=0.4.18
|
||||
maven_group=com.ejclaw.videoplayer
|
||||
archives_base_name=video_player
|
||||
|
||||
|
||||
Reference in New Issue
Block a user