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

Add option timeoutAsWarning #248

Closed
wants to merge 2 commits into from

Conversation

stereobooster
Copy link
Collaborator

@stereobooster stereobooster commented Aug 8, 2018

not sure about option name

@stereobooster stereobooster force-pushed the ignore-timeouts branch 2 times, most recently from f45ee80 to 4f3be79 Compare August 8, 2018 19:33
Copy link
Owner

@peterbe peterbe left a 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.
Copy link
Owner

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
Copy link
Owner

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.

Copy link
Owner

Choose a reason for hiding this comment

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

Also, typo on "puppeter".

@@ -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' });
Copy link
Collaborator Author

@stereobooster stereobooster Aug 8, 2018

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

@stereobooster
Copy link
Collaborator Author

Ahh it will not work, but it was nice idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants