Skip to content

Commit

Permalink
Fail open on did cache (#1934)
Browse files Browse the repository at this point in the history
fail open on did cache
  • Loading branch information
dholms authored Dec 6, 2023
1 parent 10f934b commit 5038b50
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/bsky/src/did-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ export class DidRedisCache implements DidCache {
}

async checkCache(did: string): Promise<CacheResult | null> {
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()
Expand Down

0 comments on commit 5038b50

Please sign in to comment.