Skip to content

Quitting Obsidian during playback restores the position up to 5 s early #436

Closed as not planned

Description

@chhoumann

Quitting Obsidian while an episode plays restores the position from the last checkpoint, up to about 5 seconds before the quit.

Measured in real Obsidian 1.14.4 on Linux by the PR #427 verification (V-427d): playback closed at 41.03 s restored 35.19 s. Master before #427 behaves the same (41.09 s restored 35.25 s). A plugin disable or reload saves the exact position; only an app quit loses the tail.

Cause: by design since #376, PodNotes starts no data.json write after Obsidian's quit event and only waits for a write already in flight (src/main.ts, the quit handler). Obsidian's file adapter has no atomic replace, and a write cut short by the window closing truncates data.json. #376 reproduced that truncation for pagehide, so it chose to lose a few seconds of position rather than risk the file.

Possible fixes, to weigh against that risk:

Severity: low. Up to one checkpoint interval of listening position on app quit; no other data is affected.

Activity

  1. chhoumann commented on Oct 15, 2026

    @chhoumann
    OwnerAuthor

    Closing as not planned: PodNotes keeps its checkpoint behavior on app quit.

    An investigation on Obsidian 1.14.4 (Linux) confirmed the loss (quit at 20.09 s restored 15.07 s) and measured why a final save on quit isn't safe:

    • Obsidian waits for plugins' quit tasks, but its window process destroys the window 3 seconds after the close event, whether or not those tasks finished. The same code is in 1.13.7.
    • A 500 ms quit task completed. Five-second tasks were cut off, and the normal settings writer, slowed to that length, left data.json truncated in 3 of 3 runs.

    Losing a few seconds of listening position is a much smaller harm than a truncated data.json, which is why #376 stopped writing after quit. A safe exact save would need atomic file replacement for every desktop write, and even that stays best effort when the app is killed. That isn't worth its size and risk for a few seconds of position. Mobile has no reliable final save on a process kill either.

    A plugin disable or reload still saves the exact position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions