From d348255eee880bea5b5f569ec170f235ea60edb7 Mon Sep 17 00:00:00 2001 From: Etienne Laurent Date: Tue, 16 Apr 2024 11:25:03 +0200 Subject: [PATCH] remove instantly from uploadfs (to discuss) --- lib/methods/export.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/methods/export.js b/lib/methods/export.js index d4e683b9..d4b85979 100644 --- a/lib/methods/export.js +++ b/lib/methods/export.js @@ -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); } }; };