Skip to content

Commit

Permalink
Remove warning message from postprocess step
Browse files Browse the repository at this point in the history
  • Loading branch information
janicklas-ralph committed Jan 7, 2021
1 parent b3921d3 commit 9fd0e72
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/next/next-server/lib/post-process.ts
Expand Up @@ -67,21 +67,14 @@ async function processHTML(
const root: HTMLElement = parse(html)
let document = html
// Calls the middleware, with some instrumentation and logging
async function callMiddleWare(
middleware: PostProcessMiddleware,
name: string
) {
async function callMiddleWare(middleware: PostProcessMiddleware) {
let timer = Date.now()
middleware.inspect(root, postProcessData, data)
const inspectTime = Date.now() - timer
document = await middleware.mutate(document, postProcessData, data)
timer = Date.now() - timer
if (timer > MIDDLEWARE_TIME_BUDGET) {
console.warn(
`The postprocess middleware "${name}" took ${timer}ms(${inspectTime}, ${
timer - inspectTime
}) to complete. This is longer than the ${MIDDLEWARE_TIME_BUDGET} limit.`
)
// TODO: Identify a correct upper limit for the postprocess step
// and add a warning to disable the optimization
}
return
}
Expand Down

0 comments on commit 9fd0e72

Please sign in to comment.