mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
do not fail if cache missed
This commit is contained in:
parent
6f2aa2e0cd
commit
fc9d5c64ec
1 changed files with 4 additions and 3 deletions
|
|
@ -103,16 +103,17 @@ export const cacheFetchResult = async (
|
|||
|
||||
const getCachedFetchResult = async (
|
||||
key: string
|
||||
): Promise<FetchResult | null> => {
|
||||
): Promise<FetchResult | undefined> => {
|
||||
const result = await redisDataSource.cacheClient.get(key)
|
||||
if (!result) {
|
||||
console.info('fetch result is not cached', key)
|
||||
return null
|
||||
return undefined
|
||||
}
|
||||
|
||||
const fetchResult = JSON.parse(result) as unknown
|
||||
if (!isFetchResult(fetchResult)) {
|
||||
throw new Error('fetch result is not valid')
|
||||
console.error('invalid fetch result in cache', key)
|
||||
return undefined
|
||||
}
|
||||
|
||||
console.info('fetch result is cached', key)
|
||||
|
|
|
|||
Loading…
Reference in a new issue