diff --git a/lib/http-tracker.js b/lib/http-tracker.js index 45e1d9b..a8396a7 100644 --- a/lib/http-tracker.js +++ b/lib/http-tracker.js @@ -85,6 +85,11 @@ HTTPTracker.prototype.setInterval = function (intervalMs) { } } +HTTPTracker.prototype.destroy = function () { + var self = this + self.destroyed = true +} + HTTPTracker.prototype._request = function (requestUrl, opts, cb) { var self = this @@ -92,6 +97,7 @@ HTTPTracker.prototype._request = function (requestUrl, opts, cb) { common.querystringStringify(opts) get.concat(u, function (err, data, res) { + if (self.destroyed) return if (err) return self.client.emit('warning', err) if (res.statusCode !== 200) { return self.client.emit('warning', new Error('Non-200 response code ' +