artillery-core
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -58,3 +58,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
let f = function(context, callback) { | ||
// Only process emit requests; delegate the rest to the HTTP engine | ||
// Only process emit requests; delegate the rest to the HTTP engine (or think utility) | ||
if (requestSpec.think) { | ||
return engineUtil.createThink(requestSpec); | ||
} | ||
if (!requestSpec.emit) { | ||
@@ -85,3 +88,5 @@ let delegateFunc = self.httpDelegate.step(requestSpec, ee); | ||
// Listen for the socket.io response on the specified channel | ||
let done = false; | ||
context.socketio.on(response.channel, function receive(data) { | ||
done = true; | ||
let err = processResponse(ee, data, response.data); | ||
@@ -97,2 +102,12 @@ if (!err) { | ||
context.socketio.emit(outgoing.channel, outgoing.data); | ||
// If we don't get a response within the timeout, fire an error | ||
let waitTime = self.config.timeout || 10; | ||
waitTime *= 1000; | ||
setTimeout(function responseTimeout() { | ||
if (!done) { | ||
let err = 'response timeout'; | ||
ee.emit('error', err); | ||
return callback(err, context); | ||
} | ||
}, waitTime) | ||
} else { | ||
@@ -113,3 +128,5 @@ // No return data is expected, so emit without a listener | ||
function zero(callback) { | ||
let socketio = io.connect(config.target); | ||
let tls = config.tls || {}; | ||
let options = _.extend({}, tls); | ||
let socketio = io.connect(config.target, options); | ||
socketio.on('connect', function() { | ||
@@ -119,5 +136,5 @@ ee.emit('started'); | ||
}); | ||
socketio.once('error', function(err) { | ||
socketio.once('connect_error', function(err) { | ||
debug(err); | ||
ee.emit('error', err.code); | ||
ee.emit('error', err.message); | ||
return callback(err, {}); | ||
@@ -124,0 +141,0 @@ }); |
{ | ||
"name": "artillery-core", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "core load-generating functionality of Artillery", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
62806
1376