no need to reset timeout if prelaunched

This commit is contained in:
Jonathan Lipps
2013-03-29 12:21:52 -07:00
parent dbf0795a6c
commit 2d033862c0
2 changed files with 4 additions and 11 deletions

View File

@@ -75,16 +75,12 @@ Appium.prototype.preLaunch = function(cb) {
} else {
var me = this;
var caps = {};
this.start(caps, function(err, device) {
this.start(caps, function(err) {
if (err) {
cb(err, null);
} else {
// since we're prelaunching, it might be a while before the first
// command comes in, so let's not have instruments quit on us
device.setCommandTimeout(600, function() {
me.preLaunched = true;
cb(null, me);
});
me.preLaunched = true;
cb(null, me);
}
});
}

View File

@@ -137,16 +137,13 @@ exports.createSession = function(req, res) {
var desired = req.body.desiredCapabilities;
var next = function(reqHost, sessionId, device, preLaunched) {
var next = function(reqHost, sessionId, device) {
var redirect = function() {
res.set('Location', "http://"+reqHost+"/wd/hub/session/" + sessionId);
res.send(303);
};
if (desired && desired.newCommandTimeout) {
device.setCommandTimeout(desired.newCommandTimeout, redirect);
} else if (preLaunched) {
// reset timeout to something more reasonable
device.resetCommandTimeout(redirect);
} else {
redirect();
}