Skip to content

Commit ee91dff

Browse files
committed
client: add http tracker destroy function
1 parent c048f1b commit ee91dff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/http-tracker.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,19 @@ HTTPTracker.prototype.setInterval = function (intervalMs) {
8585
}
8686
}
8787

88+
HTTPTracker.prototype.destroy = function () {
89+
var self = this
90+
self.destroyed = true
91+
}
92+
8893
HTTPTracker.prototype._request = function (requestUrl, opts, cb) {
8994
var self = this
9095

9196
var u = requestUrl + (requestUrl.indexOf('?') === -1 ? '?' : '&') +
9297
common.querystringStringify(opts)
9398

9499
get.concat(u, function (err, data, res) {
100+
if (self.destroyed) return
95101
if (err) return self.client.emit('warning', err)
96102
if (res.statusCode !== 200) {
97103
return self.client.emit('warning', new Error('Non-200 response code ' +

0 commit comments

Comments
 (0)