Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font optimization - remove warning message #20874

Merged
merged 14 commits into from Jan 13, 2021
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement doesn't do anything anymore so let's comment it out!

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