fix(storage): reset reclaim state after any restore, re-check owners often, share release ticks

- A restore (admin panel or RESTORE_FROM_BACKUP) now leaves
  data/.trek-reclaim-reset before it swaps the database in. Boot reconcile
  resets the reclaim state when it finds the file, whatever install id the
  database names, and removes it afterwards; a successful reopen removes it
  too. A restart after a failed reopen, or a boot restore of this
  installation's own backup, no longer keeps the old switch, marks and
  confirmations. The id mismatch reset stays.
- The release job skips a tick (install_mismatch) while the database names
  another installation or a reset is still pending.
- An allowed owner verdict is cached for 15 minutes, a refusal for 26 hours.
  The local driver reads a list prefix as a folder, so the category root is
  still listed whole, at most once per category per window.
- Each tick reads every allowed category's due rows separately, an equal
  share of the 200 each, so a category whose deletes keep failing cannot
  starve the others.
- Rows dropped after 30 days overdue and releases refused by a full queue
  are logged at warn with their counts.
This commit is contained in:
Maurice
2026-11-01 18:31:41 +01:00
parent 9d2ffc91af
commit bef8fc20f1
17 changed files with 432 additions and 80 deletions
+3 -1
View File
@@ -138,10 +138,12 @@ async function bootstrap(): Promise<void> {
async function restoreBeforeTheDatabaseOpens() {
const { restoreOnFirstBoot } = require('./nest/backup/boot-restore') as typeof import('./nest/backup/boot-restore');
const env = readEnv();
const paths = resolveDataPaths(env);
return restoreOnFirstBoot({
archive: env.backup.restoreFromBackup,
dbFile: resolveDbPath(),
dataDir: resolveDataPaths(env).dataDir,
dataDir: paths.dataDir,
reclaimResetFile: paths.reclaimResetFile,
});
}