quak backup refuses to run while another backup of the same directory runs, exit 2 #169

Open
opened 2026-10-06 01:17:28 +02:00 by clawbot · 0 comments
Collaborator

Part of #162 (one cron-safe command that mirrors the whole account). Dispatched after #163 and #164 land, which change the same files.

What

Two backups of the same directory never run at once. A cron run that starts while the previous one is still going exits at once.

Definition of done

  • lib.backup() takes a lock in its download directory before its refresh and releases it when it finishes or throws.
  • A second backup of the same directory, from another process or the same one, while the first runs fails at once with an error naming the directory. quak backup prints it as one line and exits 2.
  • A lock left by a run that was killed is taken over by the next run without anyone removing it by hand.
  • README "Backup layout" names the lock file and says what it is for.
  • Tests: a second backup while one runs is refused; the lock is released after success and after a failure; a lock left by a killed run is taken over.
  • TODO.md: an entry at the top of Completed Steps.

Notes

Use proper-lockfile, the widely used package for this, pinned through yarn.lock as every dependency is. No hand-written PID file. The lock lives in the download directory and must not be mistaken for an original or touched by the album cleanup.

Touches src/library/index.ts (or src/backup.ts), src/cli-commands.ts (backupCommand), package.json, yarn.lock, tests, README.md, TODO.md.

Model: opus-5-5

Part of https://git.eeqj.de/sneak/quak/issues/162 (one cron-safe command that mirrors the whole account). Dispatched after https://git.eeqj.de/sneak/quak/issues/163 and https://git.eeqj.de/sneak/quak/issues/164 land, which change the same files. ## What Two backups of the same directory never run at once. A cron run that starts while the previous one is still going exits at once. ## Definition of done - `lib.backup()` takes a lock in its download directory before its refresh and releases it when it finishes or throws. - A second backup of the same directory, from another process or the same one, while the first runs fails at once with an error naming the directory. `quak backup` prints it as one line and exits 2. - A lock left by a run that was killed is taken over by the next run without anyone removing it by hand. - README "Backup layout" names the lock file and says what it is for. - Tests: a second backup while one runs is refused; the lock is released after success and after a failure; a lock left by a killed run is taken over. - `TODO.md`: an entry at the top of Completed Steps. ## Notes Use `proper-lockfile`, the widely used package for this, pinned through `yarn.lock` as every dependency is. No hand-written PID file. The lock lives in the download directory and must not be mistaken for an original or touched by the album cleanup. Touches `src/library/index.ts` (or `src/backup.ts`), `src/cli-commands.ts` (`backupCommand`), `package.json`, `yarn.lock`, tests, `README.md`, `TODO.md`. Model: opus-5-5
clawbot self-assigned this 2026-10-06 01:17:28 +02:00
Sign in to join this conversation.