Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #53 from wpreul/master

Several fixes
  • Loading branch information...
commit bed5b63edd9ae839a99589b243bdac6b401bd9a0 2 parents 6afbd76 + 6380a9d
@geek geek authored
View
3  bin/replay 100644 → 100755
@@ -34,7 +34,8 @@ internals.start = function () {
var concurrent = internals.argv.n ? parseInt(internals.argv.n) : 10;
var log = internals.getLog();
var replay = new Replay(internals.argv.h, concurrent, log);
- replay();
+
+ replay.makeRequests();
};
internals.start();
View
6 lib/monitor.js
@@ -217,7 +217,7 @@ internals.Monitor.prototype._broadcastHttp = function () {
subscriberQueue.length = 0; // Empty queue (must not set to [] or queue reference will change)
- request('post', uri, { headers: { 'content-type': 'application/json' }, payload: JSON.stringify(envelope), timeout: self.settings.requestTimeout }, function () { });
+ request('post', uri, { headers: { 'content-type': 'application/json' }, payload: JSON.stringify(envelope), timeout: self.settings.requestTimeout });
});
};
@@ -501,6 +501,10 @@ internals.Monitor.prototype._getFileLog = function (dest, bytes, callback) {
stream: Fs.createWriteStream(filePath)
};
+ if (self._fileLogs[dest] && self._fileLogs[dest].stream) {
+ self._fileLogs[dest].stream.end();
+ }
+
self._fileLogs[dest] = fileLog;
callback(null, fileLog);
};
View
19 lib/replay.js
@@ -12,16 +12,11 @@ var internals = {};
module.exports = internals.Replay = function (host, concurrent, log) {
- var self = this;
-
this.host = host;
this.availableSockets = concurrent;
this.urls = this.parseUrls(log);
- return function () {
-
- self.makeRequests();
- };
+ return this;
};
internals.Replay.prototype.parseUrls = function (entries) {
@@ -56,7 +51,7 @@ internals.Replay.prototype.handleResponse = function (response) {
response.destroy();
});
- response.once('close', function () {
+ response.once('finish', function () {
self.makeRequest();
});
@@ -91,11 +86,19 @@ internals.Replay.prototype.makeRequest = function () {
}
Hoek.consoleFunc(url);
- var req = Http.get(url, this.handleResponse);
+ var req = Http.get(url, function (res) {
+
+ self.handleResponse(res);
+ });
req.once('error', function (err) {
Hoek.consoleFunc(err);
self.makeRequest();
});
+
+ req.once('finish', function () {
+
+ self.makeRequest();
+ });
};
View
3  package.json
@@ -1,7 +1,7 @@
{
"name": "good",
"description": "Server and process monitoring plugin",
- "version": "0.5.7",
+ "version": "0.5.8",
"author": "Van Nguyen <the.gol.effect@gmail.com>",
"contributors":[
"Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",
@@ -30,6 +30,7 @@
"hapi": "1.x.x"
},
"devDependencies": {
+ "hapi": "1.x.x",
"sinon": "1.x.x",
"lab": "0.1.x",
"complexity-report": "0.x.x"
View
6 test/replay.js
@@ -48,7 +48,7 @@ describe('Replay', function () {
};
var replay = new Replay('127.0.0.1:' + server.address().port, 10, data);
- replay();
+ replay.makeRequests();
});
server.listen(0);
@@ -83,7 +83,7 @@ describe('Replay', function () {
};
var replay = new Replay('127.0.0.1:' + server.address().port, 10, data);
- replay();
+ replay.makeRequests();
});
server.listen(0);
@@ -116,7 +116,7 @@ describe('Replay', function () {
};
var replay = new Replay('127.0.0.1:' + server.address().port, 10, data);
- replay();
+ replay.makeRequests();
});
server.listen(0);
Please sign in to comment.
Something went wrong with that request. Please try again.