Skip to content

Commit

Permalink
remove instantly from uploadfs (to discuss)
Browse files Browse the repository at this point in the history
  • Loading branch information
ETLaurent committed Apr 16, 2024
1 parent d7e4882 commit d348255
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/methods/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,22 @@ module.exports = self => {
// Report is available for 10 minutes by default
removeFromUploadFs(downloadPath, expiration) {
const ms = expiration || 1000 * 60 * 10;
console.info(`[export] removing ${self.apos.rootDir}/public/uploads${downloadPath} from uploadfs in ${ms / 1000 / 60} minutes`);
setTimeout(() => {
const remove = () => {
console.info(`[export] removing ${self.apos.rootDir}/public/uploads${downloadPath} from uploadfs`);
self.apos.attachment.uploadfs.remove(downloadPath, error => {
if (error) {
self.apos.util.error(error);
}
});
}, ms);
};

if (process.env.CI) {
remove();
return;
}

console.info(`[export] removing ${self.apos.rootDir}/public/uploads${downloadPath} from uploadfs in ${ms / 1000 / 60} minutes`);
setTimeout(remove, ms);
}
};
};

0 comments on commit d348255

Please sign in to comment.