···11import { userIdentity } from '~~/server/db/schema'
22+import { enqueue } from '~~/server/utils/queue'
23import { generateAndPublishKey } from '~~/server/utils/tangled-pubkey'
3445export default defineEventHandler(async event => {
···3233 oauthSession: session,
3334 installationId,
3435 })
3636+3737+ // Backfill: enqueue a single job that walks the installation's repo list
3838+ // and fans out per-repo enrolment. Doing this in the worker (rather than
3939+ // inline here) keeps the OAuth callback fast regardless of repo count, and
4040+ // gives us proper retry semantics if pagination doesn't finish in one
4141+ // worker tick.
4242+ await enqueue('tangled.backfill-installation', { installationId, page: 1 })
35433644 await sendRedirect(event, '/dashboard', 302)
3745})