Repository: cordova-medic Updated Branches: refs/heads/master 94554b93a -> cb2c7d530
CB-10540: Changing request call to non-streaming version Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/cb2c7d53 Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/cb2c7d53 Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/cb2c7d53 Branch: refs/heads/master Commit: cb2c7d530fa7994732c878b540e2e6383a80c8d4 Parents: 94554b9 Author: Raghav Katyal <[email protected]> Authored: Fri Feb 12 12:27:23 2016 -0800 Committer: Raghav Katyal <[email protected]> Committed: Fri Feb 12 12:29:20 2016 -0800 ---------------------------------------------------------------------- medic/medic-run.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/cb2c7d53/medic/medic-run.js ---------------------------------------------------------------------- diff --git a/medic/medic-run.js b/medic/medic-run.js index bdd03b8..faba135 100644 --- a/medic/medic-run.js +++ b/medic/medic-run.js @@ -263,24 +263,27 @@ function failedBecauseNoDevice(output) { function tryConnect(couchdbURI, pendingNumberOfTries, callback) { util.medicLog("checking if " + couchdbURI + " is up."); - + // check if results server is up request({ uri: couchdbURI, method: "GET", timeout: SERVER_RESPONSE_TIMEOUT - }).on('response', function (response){ - callback(); - }).on('error', function (error){ - if(pendingNumberOfTries > 1) { - util.medicLog("it's not up. Going to retry after " + WAIT_TIME_TO_RETRY_CONNECTION + " milliseconds"); - setTimeout(function (){ - tryConnect(couchdbURI, pendingNumberOfTries-1 , callback); - }, WAIT_TIME_TO_RETRY_CONNECTION); - } else { - util.fatal("it's not up even after " + MAX_NUMBER_OF_TRIES + " attempts to connect, so test run can't be monitored"); - process.exit(1); + }, function (error, response, body){ + if(error) { + if(pendingNumberOfTries > 1) { + util.medicLog("it's not up. Going to retry after " + WAIT_TIME_TO_RETRY_CONNECTION + " milliseconds"); + setTimeout(function (){ + tryConnect(couchdbURI, pendingNumberOfTries-1 , callback); + }, WAIT_TIME_TO_RETRY_CONNECTION); + } else { + util.fatal("it's not up even after " + MAX_NUMBER_OF_TRIES + " attempts to connect, so test run can't be monitored"); + process.exit(1); + } } + else { + callback(); + } }); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
