mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Update logs for cache purge
This commit is contained in:
parent
89aa4a8bdc
commit
c881bcbe59
@ -8,7 +8,6 @@ class CacheController {
|
|||||||
if (!req.user.isAdminOrUp) {
|
if (!req.user.isAdminOrUp) {
|
||||||
return res.sendStatus(403)
|
return res.sendStatus(403)
|
||||||
}
|
}
|
||||||
Logger.info(`[MiscController] Purging all cache`)
|
|
||||||
await this.cacheManager.purgeAll()
|
await this.cacheManager.purgeAll()
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
}
|
}
|
||||||
@ -18,7 +17,6 @@ class CacheController {
|
|||||||
if (!req.user.isAdminOrUp) {
|
if (!req.user.isAdminOrUp) {
|
||||||
return res.sendStatus(403)
|
return res.sendStatus(403)
|
||||||
}
|
}
|
||||||
Logger.info(`[MiscController] Purging items cache`)
|
|
||||||
await this.cacheManager.purgeItems()
|
await this.cacheManager.purgeItems()
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ class CacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async purgeAll() {
|
async purgeAll() {
|
||||||
|
Logger.info(`[CacheManager] Purging all cache at "${this.CachePath}"`)
|
||||||
if (await fs.pathExists(this.CachePath)) {
|
if (await fs.pathExists(this.CachePath)) {
|
||||||
await fs.remove(this.CachePath).catch((error) => {
|
await fs.remove(this.CachePath).catch((error) => {
|
||||||
Logger.error(`[CacheManager] Failed to remove cache dir "${this.CachePath}"`, error)
|
Logger.error(`[CacheManager] Failed to remove cache dir "${this.CachePath}"`, error)
|
||||||
@ -125,6 +126,7 @@ class CacheManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async purgeItems() {
|
async purgeItems() {
|
||||||
|
Logger.info(`[CacheManager] Purging items cache at "${this.ItemCachePath}"`)
|
||||||
if (await fs.pathExists(this.ItemCachePath)) {
|
if (await fs.pathExists(this.ItemCachePath)) {
|
||||||
await fs.remove(this.ItemCachePath).catch((error) => {
|
await fs.remove(this.ItemCachePath).catch((error) => {
|
||||||
Logger.error(`[CacheManager] Failed to remove items cache dir "${this.ItemCachePath}"`, error)
|
Logger.error(`[CacheManager] Failed to remove items cache dir "${this.ItemCachePath}"`, error)
|
||||||
|
Loading…
Reference in New Issue
Block a user