From 5038b50428be04b40a772f20fc0ee481c13676cd Mon Sep 17 00:00:00 2001 From: Daniel Holmgren Date: Tue, 5 Dec 2023 18:08:41 -0600 Subject: [PATCH] Fail open on did cache (#1934) fail open on did cache --- packages/bsky/src/did-cache.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/bsky/src/did-cache.ts b/packages/bsky/src/did-cache.ts index 2c4d6e43c1d..9e45d0d8b30 100644 --- a/packages/bsky/src/did-cache.ts +++ b/packages/bsky/src/did-cache.ts @@ -42,7 +42,13 @@ export class DidRedisCache implements DidCache { } async checkCache(did: string): Promise { - const got = await this.redis.get(did) + let got: string | null + try { + got = await this.redis.get(did) + } catch (err) { + got = null + log.error({ did, err }, 'error fetching did from cache') + } if (!got) return null const { doc, updatedAt } = JSON.parse(got) as CacheResult const now = Date.now()