Skip to content

Commit

Permalink
Clear DID cache for did:plc: after identity.updateHandle
Browse files Browse the repository at this point in the history
On a self-hosted PDS, updating an account's handle via
`com.atproto.identity.updateHandle` won't change the reported `handle`
value in `com.atproto.repo.describeRepo`, since the did cache still has
stale data.

To solve this, we just clear the cache after the updateHandle endpoint
gets hit.
  • Loading branch information
char committed Jan 18, 2025
1 parent 5417476 commit 439062c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/pds/src/api/com/atproto/identity/updateHandle.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import assert from 'node:assert'
import { InvalidRequestError } from '@atproto/xrpc-server'
import { DAY, MINUTE } from '@atproto/common'
import { InvalidRequestError } from '@atproto/xrpc-server'
import assert from 'node:assert'
import AppContext from '../../../../context'
import { normalizeAndValidateHandle } from '../../../../handle'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { httpLogger } from '../../../../logger'
import { ids } from '../../../../lexicon/lexicons'
import { httpLogger } from '../../../../logger'

export default function (server: Server, ctx: AppContext) {
server.com.atproto.identity.updateHandle({
Expand Down Expand Up @@ -80,6 +80,8 @@ export default function (server: Server, ctx: AppContext) {
}
}

await ctx.didCache.clearEntry(account.did)

try {
await ctx.sequencer.sequenceHandleUpdate(requester, handle)
await ctx.sequencer.sequenceIdentityEvt(requester, handle)
Expand Down

0 comments on commit 439062c

Please sign in to comment.