I hate this so much

This commit is contained in:
Essem 2022-07-19 23:44:44 -05:00
parent 1713387ffd
commit c4272d3c17
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
1 changed files with 3 additions and 3 deletions

View File

@ -34,8 +34,8 @@ export async function upload(client, ipc, result, context, interaction = false)
}));
}
if (process.env.THRESHOLD) {
const size = ipc.centralStore.get("dirSizeCache") + result.file.length;
ipc.centralStore.set("dirSizeCache", size);
const size = await ipc.centralStore.get("dirSizeCache") + result.file.length;
await ipc.centralStore.set("dirSizeCache", size);
await removeOldImages(ipc, size);
}
}
@ -61,7 +61,7 @@ export async function removeOldImages(ipc, size) {
if (!oldestFiles[0]) break;
await rm(`${process.env.TEMPDIR}/${oldestFiles[0].name}`);
newSize -= oldestFiles[0].size;
ipc.centralStore.set("dirSizeCache", newSize);
await ipc.centralStore.set("dirSizeCache", newSize);
logger.log(`Removed oldest image file: ${oldestFiles[0].name}`);
oldestFiles.shift();
}