mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-30 19:38:28 +03:00
Make sure latest dump is not deleted
This commit is contained in:
@@ -96,10 +96,12 @@ function removeOutdatedDumps(exportPath: string): Promise<void> {
|
|||||||
for (const tableName in tableFiles) {
|
for (const tableName in tableFiles) {
|
||||||
const files = tableFiles[tableName].sort((a, b) => b.timestamp - a.timestamp);
|
const files = tableFiles[tableName].sort((a, b) => b.timestamp - a.timestamp);
|
||||||
for (let i = 2; i < files.length; i++) {
|
for (let i = 2; i < files.length; i++) {
|
||||||
// remove old file
|
if (!latestDumpFiles.some((file) => file.fileName === files[i].file.match(/[^/]+$/)[0])) {
|
||||||
await unlink(files[i].file).catch((error: any) => {
|
// remove old file
|
||||||
Logger.error(`[dumpDatabase] Garbage collection failed ${error}`);
|
await unlink(files[i].file).catch((error: any) => {
|
||||||
});
|
Logger.error(`[dumpDatabase] Garbage collection failed ${error}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
Reference in New Issue
Block a user