Skip to content

Commit 6e41ecc

Browse files
committed
fix: use DID consistently for profile cache keys
1 parent 2e1bbd7 commit 6e41ecc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

server/utils/atproto/utils/profile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ export class ProfileUtils {
4545
* @returns
4646
*/
4747
async getProfile(handle: string): Promise<NPMXProfile | undefined> {
48-
const profileKey = CACHE_PROFILE_KEY(handle)
48+
const miniDoc = await this.slingshotMiniDoc(handle)
49+
const profileKey = CACHE_PROFILE_KEY(miniDoc.did)
4950
const cachedProfile = await this.cache.get<NPMXProfile>(profileKey)
5051

5152
let profile: NPMXProfile | undefined
5253
if (cachedProfile) {
5354
profile = cachedProfile
5455
} else {
55-
const miniDoc = await this.slingshotMiniDoc(handle)
5656
const profileUri = `at://${miniDoc.did}/dev.npmx.actor.profile/self`
5757
const response = await fetch(
5858
`https://${SLINGSHOT_HOST}/xrpc/blue.microcosm.repo.getRecordByUri?at_uri=${profileUri}`,
@@ -72,7 +72,7 @@ export class ProfileUtils {
7272

7373
async updateProfileCache(handle: string, profile: NPMXProfile): Promise<NPMXProfile | undefined> {
7474
const miniDoc = await this.slingshotMiniDoc(handle)
75-
const profileKey = CACHE_PROFILE_KEY(miniDoc.handle)
75+
const profileKey = CACHE_PROFILE_KEY(miniDoc.did)
7676
await this.cache.set(profileKey, profile, CACHE_MAX_AGE)
7777
return profile
7878
}

0 commit comments

Comments
 (0)