From c881bcbe59c8b1cbc799d225aa4259d0249099a7 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 14 Jul 2023 15:04:27 -0500 Subject: [PATCH] Update logs for cache purge --- server/controllers/CacheController.js | 2 -- server/managers/CacheManager.js | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/controllers/CacheController.js b/server/controllers/CacheController.js index a489c270..815af44d 100644 --- a/server/controllers/CacheController.js +++ b/server/controllers/CacheController.js @@ -8,7 +8,6 @@ class CacheController { if (!req.user.isAdminOrUp) { return res.sendStatus(403) } - Logger.info(`[MiscController] Purging all cache`) await this.cacheManager.purgeAll() res.sendStatus(200) } @@ -18,7 +17,6 @@ class CacheController { if (!req.user.isAdminOrUp) { return res.sendStatus(403) } - Logger.info(`[MiscController] Purging items cache`) await this.cacheManager.purgeItems() res.sendStatus(200) } diff --git a/server/managers/CacheManager.js b/server/managers/CacheManager.js index ebf02aff..f92f0e48 100644 --- a/server/managers/CacheManager.js +++ b/server/managers/CacheManager.js @@ -53,7 +53,7 @@ class CacheManager { if (await fs.pathExists(path)) { if (global.XAccel) { Logger.debug(`Use X-Accel to serve static file ${path}`) - return res.status(204).header({'X-Accel-Redirect': global.XAccel + path}).send() + return res.status(204).header({ 'X-Accel-Redirect': global.XAccel + path }).send() } const r = fs.createReadStream(path) @@ -79,7 +79,7 @@ class CacheManager { if (global.XAccel) { Logger.debug(`Use X-Accel to serve static file ${writtenFile}`) - return res.status(204).header({'X-Accel-Redirect': global.XAccel + writtenFile}).send() + return res.status(204).header({ 'X-Accel-Redirect': global.XAccel + writtenFile }).send() } var readStream = fs.createReadStream(writtenFile) @@ -116,6 +116,7 @@ class CacheManager { } async purgeAll() { + Logger.info(`[CacheManager] Purging all cache at "${this.CachePath}"`) if (await fs.pathExists(this.CachePath)) { await fs.remove(this.CachePath).catch((error) => { Logger.error(`[CacheManager] Failed to remove cache dir "${this.CachePath}"`, error) @@ -125,6 +126,7 @@ class CacheManager { } async purgeItems() { + Logger.info(`[CacheManager] Purging items cache at "${this.ItemCachePath}"`) if (await fs.pathExists(this.ItemCachePath)) { await fs.remove(this.ItemCachePath).catch((error) => { Logger.error(`[CacheManager] Failed to remove items cache dir "${this.ItemCachePath}"`, error)