-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add option timeoutAsWarning #248
Conversation
f45ee80
to
4f3be79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get nervous about this change. It's weird that safeReject
gets called but then it decides to exit out of that.
I'd need to see how this works. Do you have some URLs I can play with on the command line?
Also, where it usually happens, this bug, can we not do something like:
...
// Oh shit this is not good!
// But before we reject the whole thing,
// check that it's not because a bogus timeout
// See this URLHERE about a bug in puppeteer.
if (tracker.urls().length) {
safeReject('Crap!')
} else if (timeoutAsWarning) {
// When verbose warn about weird timeouts without active URLs
console.warn("Crap but no URLs actually timed out")
}
README.md
Outdated
@@ -176,6 +176,7 @@ key is `urls`. Other optional options are: | |||
of strings for headless Chrome](https://peter.sh/experiments/chromium-command-line-switches/). | |||
* `cssoOptions` - CSSO compress function [options](https://github.com/css/csso#compressast-options) | |||
* `timeout` - Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. | |||
* `timeoutAsWarning` - This is workaround for the bug in puppeter, when there are no open connections but puppeteer reports it as timeout anyway. If you set it to true minimalcss will report timeouts as warnings instead of rejection. Take a note real timeouts still be reported as errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the bug in puppeteer" should be a link to the bug.
src/run.js
Outdated
@@ -137,8 +136,14 @@ const processPage = ({ | |||
)}`; | |||
} else if (urls.length > 0) { | |||
error.message += `\nFor ${urls[0]}`; | |||
} else if (options.timeoutAsWarning) { | |||
// This is workaround for the bug in puppeter, when there are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, a URL to the bug here would be super useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, typo on "puppeter".
4f3be79
to
9887209
Compare
@@ -285,7 +285,21 @@ const processPage = ({ | |||
// Second, goto the page and evaluate it with JavaScript. | |||
// The 'waitUntil' option determines how long we wait for all | |||
// possible assets to load. | |||
response = await page.goto(pageUrl, { waitUntil: 'networkidle0' }); | |||
try { | |||
response = await page.goto(pageUrl, { waitUntil: 'networkidle0' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will not work, we do not have response
in case of error
Ahh it will not work, but it was nice idea |
not sure about option name