Fix: Redis call chain #147

Merged
KevinMidboe merged 3 commits from fix/redis-call-chain into master 2022-09-25 11:39:49 +00:00
Showing only changes of commit 9e77fe8801 - Show all commits

View File

@@ -194,9 +194,12 @@ class Plex {
return new Promise((resolve, reject) =>
this.cache
.get(cacheKey)
.catch(() => fetch(url, options)) // else fetch fresh data
.then(successfullResponse)
.then(results => this.cache.set(cacheKey, results, 21600)) // 6 hours
.catch(error => {
// else fetch fresh data
return fetch(url, options)
.then(successfullResponse)
.then(results => this.cache.set(cacheKey, results, 21600)); // 6 hours
})
.then(mapResults)
.then(resolve)
.catch(error => {