All problems

A Shared Autosave Timer Cancels Saves for Other Documents

Level 2 · node · Concurrency · Shared debounce timer across independent documents

Scenario

A fictional collaborative editor can keep several documents open. It debounces edits so repeated changes to the same document are saved only once, while changes to different documents must be saved independently. Currently editing a second document cancels the pending save for the first. A deterministic virtual scheduler is provided; no network or real clock is required.

Requirements

Coalesce consecutive edits to the same document so only the newest content is saved, without canceling pending saves for other documents. Track pending timers separately by document ID and clear each reservation when it runs.

Acceptance criteria

  • Editing one document saves its content after the debounce interval.
  • Repeated edits to the same document save only the latest content.
  • Edits to two different documents are both saved.
  • Scheduling another document does not cancel an existing document's save.