Merge pull request #126 from Autarc/fix-callback-on-destroy

invoke callbacks of destroyed trackers
This commit is contained in:
Feross Aboukhadijeh 2016-03-14 19:12:43 -07:00
commit 2fee125554
3 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ HTTPTracker.prototype.scrape = function (opts) {
HTTPTracker.prototype.destroy = function (cb) { HTTPTracker.prototype.destroy = function (cb) {
var self = this var self = this
if (self.destroyed) return if (self.destroyed) return cb && cb()
self.destroyed = true self.destroyed = true
clearInterval(self.interval) clearInterval(self.interval)

View File

@ -47,7 +47,7 @@ UDPTracker.prototype.scrape = function (opts) {
UDPTracker.prototype.destroy = function (cb) { UDPTracker.prototype.destroy = function (cb) {
var self = this var self = this
if (self.destroyed) return if (self.destroyed) return cb && cb()
self.destroyed = true self.destroyed = true
clearInterval(self.interval) clearInterval(self.interval)

View File

@ -66,7 +66,7 @@ WebSocketTracker.prototype.scrape = function (opts) {
WebSocketTracker.prototype.destroy = function (onclose) { WebSocketTracker.prototype.destroy = function (onclose) {
var self = this var self = this
if (self.destroyed) return if (self.destroyed) return onclose && onclose()
self.destroyed = true self.destroyed = true
clearInterval(self.interval) clearInterval(self.interval)