Skip to content

Commit

Permalink
ensure register only get called once
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Aug 7, 2024
1 parent ab9c14b commit f416a34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next/src/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export default class NextNodeServer extends BaseServer<
protected middlewareManifestPath: string
private _serverDistDir: string | undefined
private imageResponseCache?: ResponseCache
private registeredInstrumentation: boolean = false
protected renderWorkersPromises?: Promise<void>
protected dynamicRoutes?: {
match: import('../shared/lib/router/utils/route-matcher').RouteMatchFn
Expand Down Expand Up @@ -324,6 +325,8 @@ export default class NextNodeServer extends BaseServer<
}

protected async runInstrumentationHookIfAvailable() {
if (this.registeredInstrumentation) return
this.registeredInstrumentation = true
await this.instrumentation?.register?.()
}

Expand Down

0 comments on commit f416a34

Please sign in to comment.