Skip to content

fix: treat unconfirmed cache dir-fsync as a warning, not a save failure#100

Closed
cplieger wants to merge 1 commit into
mainfrom
fix/atomicfile-durability-aware-cache-writes
Closed

fix: treat unconfirmed cache dir-fsync as a warning, not a save failure#100
cplieger wants to merge 1 commit into
mainfrom
fix/atomicfile-durability-aware-cache-writes

Conversation

@cplieger

@cplieger cplieger commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

atomicfile now returns *WriteError{Phase: PhaseDirSync} when the parent-directory fsync fails after a successful rename: the cache is written, only its durability across an immediate crash is unconfirmed.

cache.json is reconstructible (it is rebuilt from Plex on the next run), so a durability-only failure should not fail the whole cache write. Cache.SaveTo now logs a warning and returns nil on PhaseDirSync, while still propagating genuine write failures.

Dependency / merge order

Depends on atomicfile v1.1.0 (the PhaseDirSync API). CI will be red here until Renovate bumps the atomicfile dependency after that release. Merge only after the go.mod bump lands.

atomicfile now returns *WriteError{PhaseDirSync} when the parent-directory
fsync fails after a successful rename. cache.json is reconstructible (it is
rebuilt from Plex on the next run), so a durability-only failure should not fail
the cache write. SaveTo now logs a warning and returns nil on PhaseDirSync,
while still propagating genuine write failures.

Depends on atomicfile v1.1.0 (PhaseDirSync). CI is red until Renovate bumps the
atomicfile dependency after that release; merge only after the bump lands.
@cplieger

cplieger commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

Moved the cache dir-fsync durability fix into #108 (Library adoption) via cherry-pick. Closing in favor of that PR.

@cplieger cplieger closed this Jun 9, 2026
@cplieger cplieger deleted the fix/atomicfile-durability-aware-cache-writes branch June 9, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant