-
Notifications
You must be signed in to change notification settings - Fork 63
Retry opening URL if worker-browser fails to send request within ackTimeout #123
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
Conversation
@@ -265,12 +252,14 @@ exports.Server = function Server(bsClient, workers) { | |||
} | |||
|
|||
if (reusedWorker) { | |||
logger.debug('[%s] Reused', getTestBrowserInfo(worker)); | |||
logger.debug('[%s] Reused', worker.getTestBrowserInfo()); | |||
worker.awaitAck(true); |
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.
Boolean flags like this are difficult to understand without looking at the method signature. How about a separate resetAck()
method that clears the timeout? Then you'd call both resetAck()
and awaitAck()
here.
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.
Agreed. I was contemplating adding a worker.reset() to reset state and timers for reused workers, but then thought of keeping the changes as local to this issue as possible. : )
Looks much better, still a few things to address. |
Modified as per your suggestions. Let me know if you'd still like to use |
Looks good. |
Should rebase/squash the whole thing into a single commit before landing it in master. |
Done. |
👍 |
Retry opening URL if worker-browser fails to send request within ackTimeout
After some digging I have found out that this pull request does not fix the blank page issue.
this.ackTimeout = setTimeout(function () {
if (self.isAckd) { // Then if the page fails to load, this expression is getting true and then it return. And nothing else will happen
// Already ack'd
return;
}
// worker has not acknowledged itself in 60 sec, reopen url
client.changeUrl(self.id, { url: self.buildUrl() }, function () {
logger.debug("[%s] Sent Request to reload url", self.getTestBrowserInfo());
});
}, ackTimeout * 1000); Example in the log: [OS X Yosemite, Safari 8.0] Received ack
Example: 00:01 - Open url http://localhost:8888/test.html?_worker_key=1539fd49-2783-4e91-8cfd-e192afec9f2c&_browser_string=OS%20X%20Yosemite%2C%20Safari%208.0
I have done a temporary fix local, where I in the function "testActivityTimeout" try to reload the page 1 time if the test is not completed within the specified timeout. Another solution I tried that worked was to listen if any request was made to "_/report" within the specified timeout, and if not reload the page, that also works. Let me know if you have any questions. |
Run with
--verbose
to see ack check and re-request behaviour.