File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,12 @@ import { nextResponseProxy } from '../revalidate.js'
1616
1717import { createRequestContext , getLogger , getRequestContext } from './request-context.cjs'
1818import { getTracer } from './tracer.cjs'
19- import { setWaitUntil } from './wait-until.cjs'
19+ import { setupWaitUntil } from './wait-until.cjs'
2020
2121const nextImportPromise = import ( '../next.cjs' )
2222
23+ setupWaitUntil ( )
24+
2325let nextHandler : WorkerRequestHandler , nextConfig : NextConfigComplete
2426
2527/**
@@ -53,7 +55,7 @@ interface FutureContext extends Context {
5355
5456export default async ( request : Request , context : FutureContext ) => {
5557 const tracer = getTracer ( )
56- setWaitUntil ( context )
58+
5759 if ( ! nextHandler ) {
5860 await tracer . withActiveSpan ( 'initialize next server' , async ( ) => {
5961 // set the server config
Original file line number Diff line number Diff line change 1+ import { getRequestContext } from './request-context.cjs'
2+
13/**
24 * @see https://github.com/vercel/next.js/blob/canary/packages/next/src/server/after/builtin-request-context.ts
35 */
@@ -14,15 +16,11 @@ type GlobalThisWithRequestContext = typeof globalThis & {
1416/**
1517 * Registers a `waitUntil` to be used by Next.js for next/after
1618 */
17-
18- export function setWaitUntil ( { waitUntil } : { waitUntil ?: ( promise : Promise < unknown > ) => void } ) {
19- if ( ! waitUntil ) {
20- return
21- }
19+ export function setupWaitUntil ( ) {
2220 // eslint-disable-next-line @typescript-eslint/no-extra-semi
2321 ; ( globalThis as GlobalThisWithRequestContext ) [ NEXT_REQUEST_CONTEXT_SYMBOL ] = {
2422 get ( ) {
25- return { waitUntil }
23+ return { waitUntil : getRequestContext ( ) ?. trackBackgroundWork }
2624 } ,
2725 }
2826}
You can’t perform that action at this time.
0 commit comments