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

Have supported browsers reject promises if a request takes too long #159

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

missyjcat
Copy link
Contributor

When running integration test, if a socket hung up or a request was taking way too long, we would have to wait the full 5 minute timeout before the test runner would return. This will make it so that we wait a reasonable amount of time before rejecting the promise and ending the test.

  • Firefox and PhantomJS have their own timeout handlers, so just reject when the error pops up
  • Implemented a manual timeout handler for Chrome interface (since CDP is proxying to Chrome via remote protocols)
  • Wrote test
  • Updated chrome-remote-interface which now includes a timeout for the request to the Chrome remote (not related)

Firefox and PhantomJS have their own timeout handlers
Implemented a manual timeout handler for Chrome interface (since CDP is proxying
to Chrome via remote protocols)
Wrote test
Copy link
Owner

@KevinGrandon KevinGrandon left a comment

Choose a reason for hiding this comment

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

This looks great! Can we add yarn.lock in another diff? This package is still old school and most folks have just been using NPM. Happy to consider yarn, but if we can isolate that to another diff that would be ideal.

Left some other comments, but I think the only thing we need to really do is make sure CI is passing. I'm not sure why this broke other tests, but I can help look later too.

@@ -130,6 +130,7 @@ class Ghost {
* Injects javascript and other things we need.
*/
onOpen () {
console.log('on open called')
Copy link
Owner

Choose a reason for hiding this comment

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

Can we remove for the time being? I would like a way for more verbose logs, but I want to allow people to opt into it.

handler: function (req, reply) {
setTimeout(function() {
reply('Finally responding.')
}, 100000)
Copy link
Owner

Choose a reason for hiding this comment

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

Nice job with the test! 👍

Copy link
Owner

Choose a reason for hiding this comment

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

I'm wondering if this route should take a timeout in the query string? Then maybe we can do other things with it.

const raceServerResponse = setTimeout(() => {
// If this setTimeout beat the error response, we're waiting too long
flag = false
}, 90000)
Copy link
Owner

Choose a reason for hiding this comment

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

Is this still deterministic if we make this 30s or so? Ghost CI doesn't have great parallelism because we just use travis, so I am still a bit conscious on run time. Just wondering if we can use a shorter time here.

@missyjcat
Copy link
Contributor Author

@KevinGrandon I'll look into tests failing and your other comments tonight. I might have configured the server routes incorrectly.

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