Re-enable orphaned attachment cleanup

This commit is contained in:
Scott Nonnenberg 2018-08-08 10:00:33 -07:00
parent 15751f3521
commit 9f920aa35b
4 changed files with 40 additions and 11 deletions

View file

@ -22,6 +22,7 @@ const DATABASE_UPDATE_TIMEOUT = 2 * 60 * 1000; // two minutes
const SQL_CHANNEL_KEY = 'sql-channel';
const ERASE_SQL_KEY = 'erase-sql-key';
const ERASE_ATTACHMENTS_KEY = 'erase-attachments';
const CLEANUP_ORPHANED_ATTACHMENTS_KEY = 'cleanup-orphaned-attachments';
const _jobs = Object.create(null);
const _DEBUG = false;
@ -64,6 +65,7 @@ module.exports = {
removeAll,
removeOtherData,
cleanupOrphanedAttachments,
// Returning plain JSON
getMessagesNeedingUpgrade,
@ -388,6 +390,10 @@ async function removeAll() {
await channels.removeAll();
}
async function cleanupOrphanedAttachments() {
await callChannel(CLEANUP_ORPHANED_ATTACHMENTS_KEY);
}
// Note: will need to restart the app after calling this, to set up afresh
async function removeOtherData() {
await Promise.all([