mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
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:
@@ -35,6 +35,14 @@ export interface DataPaths {
|
||||
* restored or copied from another install is told apart by it (storage reclaim).
|
||||
*/
|
||||
readonly installIdFile: string;
|
||||
/**
|
||||
* `data/.trek-reclaim-reset`: left by a restore right before it swaps the
|
||||
* database in, removed once storage reclaim has dropped the state the swapped
|
||||
* database brought. A start that finds it resets that state first, so a
|
||||
* restore whose reopen failed, or one at boot, is covered even when the
|
||||
* backup came from this installation. Never part of a backup.
|
||||
*/
|
||||
readonly reclaimResetFile: string;
|
||||
/**
|
||||
* The SQLite file a non-test process opens: TREK_DB_FILE when set, else
|
||||
* `data/travel.db`. Under NODE_ENV=test the connection is `:memory:` instead
|
||||
@@ -65,6 +73,7 @@ export function resolveDataPaths(
|
||||
jwtSecretFile: path.join(dataDir, '.jwt_secret'),
|
||||
encryptionKeyFile: path.join(dataDir, '.encryption_key'),
|
||||
installIdFile: path.join(dataDir, '.trek-install-id'),
|
||||
reclaimResetFile: path.join(dataDir, '.trek-reclaim-reset'),
|
||||
dbFile: env.db.trekDbFile || path.join(dataDir, 'travel.db'),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user