diff --git a/lib/get-tweets.ts b/lib/get-tweets.ts index 9618266e3e..9234f3420e 100644 --- a/lib/get-tweets.ts +++ b/lib/get-tweets.ts @@ -35,7 +35,7 @@ async function getTweetImpl(tweetId: string): Promise { try { try { const cachedTweet = await db.get(cacheKey) - if (cachedTweet) { + if (cachedTweet || cachedTweet === null) { return cachedTweet } } catch (err) { @@ -43,7 +43,7 @@ async function getTweetImpl(tweetId: string): Promise { console.warn(`redis error get "${cacheKey}"`, err.message) } - const tweetData = await getTweetData(tweetId) + const tweetData = (await getTweetData(tweetId)) || null try { await db.set(cacheKey, tweetData)