Resumable backup import

This commit is contained in:
Fedor Indutny
2024-08-27 17:00:41 -04:00
committed by GitHub
parent 3d8aaf0a5a
commit 8ef149e3a8
17 changed files with 498 additions and 33 deletions

View File

@@ -275,6 +275,22 @@ async function cleanupOrphanedAttachments({
);
}
{
const downloads: Array<string> = await sql.sqlRead('getKnownDownloads');
let missing = 0;
for (const known of downloads) {
if (!orphanedDownloads.delete(known)) {
missing += 1;
}
}
console.log(
`cleanupOrphanedAttachments: found ${downloads.length} downloads ` +
`(${missing} missing), ${orphanedDownloads.size} remain`
);
}
// This call is intentionally not awaited. We block the app while running
// all fetches above to ensure that there are no in-flight attachments that
// are saved to disk, but not put into any message or conversation model yet.