From 809f659f3dcf77c888b4300103a430432c994059 Mon Sep 17 00:00:00 2001 From: Essem Date: Tue, 19 Jul 2022 21:28:52 -0500 Subject: [PATCH] Fix dir size checking --- utils/tempimages.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/tempimages.js b/utils/tempimages.js index eba6603..46b6bd6 100644 --- a/utils/tempimages.js +++ b/utils/tempimages.js @@ -34,7 +34,6 @@ export async function upload(client, result, context, interaction = false) { })); } if (process.env.THRESHOLD) { - process.env.DIRSIZECACHE += result.file.length; await removeOldImages(); } } @@ -53,7 +52,7 @@ export async function removeOldImages() { }).filter(Boolean); const resolvedFiles = await Promise.all(files); process.env.DIRSIZECACHE = resolvedFiles.reduce((a, b)=>{ - return a + b.size; + return a.size + b.size; }, 0); const oldestFiles = resolvedFiles.sort((a, b) => a.ctime - b.ctime); while (process.env.DIRSIZECACHE > process.env.THRESHOLD) {