Way to silence "warning Query takes too long"? #30767
Replies: 2 comments 1 reply
-
i'm having this issue also. i've made a pr #34279 to add an option for this. in the meantime i'm using this dirty fix in my const reporter = require('gatsby-cli/lib/reporter');
// monkey patch reporter.warn to avoid spam when reporting long running queries
const originalReporterWarn = reporter.warn;
reporter.warn = text => {
if (
text.includes('Query takes too long') ||
text.includes('This query took more than 15s to run')
) {
return originalReporterWarn(text.replace(/Context:.*/s, ''));
}
return originalReporterWarn(text);
}; |
Beta Was this translation helpful? Give feedback.
-
As per @KyleAMathews request on discord I'm adding info to this thread. For me @redabacha solution didn't work. I'm on Gatsby 3.14.6 (I know upgrading would probably help build time but it's not trivial). We were timing out on Netlify with build of 1h for now we solved the problem by redirecting all output:
This is obviously not a long term solution as it means we have zero view on the logs. But it sped up the build process a lot now the build takes ~10 minutes. Printing the entire context can lead to huge amounts of logs depending on the site. |
Beta Was this translation helpful? Give feedback.
-
Hey folks - I believe we're having the same GraphQL issue as here:
#30256
Perhaps this is a bandaid solution but I'm exploring options / requesting a feature to be able to silence these warnings:
ethereum/ethereum-org-website#2810
Specifically, we'd like to silence the logging of page context:
gatsby/packages/gatsby/src/query/query-runner.ts
Line 41 in 54d4721
Reason being, we use the
gatsby-plugin-intl
community plugin, which stores all our content strings in message data in the context object. Whenever this warning logs the context, this results in >1K lines of output, which makes our build logs nearly impossible to sift through (& often breaks the build logs UI in Netlify).Would it be possible to add some ENV variable or feature flag to
reportLongRunningQueryJob
so that we could silence this logs?Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions