Batch mDNS discovery callbacks to every 500 ms

This commit is contained in:
Cameron Gutman 2018-11-17 13:17:55 -08:00
parent 9536c3f8c8
commit e6f4247ae8

View File

@ -142,13 +142,13 @@ ServiceFinder.prototype.onReceive_ = function(info) {
byIP[ptr] = true; byIP[ptr] = true;
}.bind(this)); }.bind(this));
// Ping! Something new is here. Only update every 25ms. // Ping! Something new is here. Only update every 500ms.
if (!this.callback_pending_) { if (!this.callback_pending_) {
this.callback_pending_ = true; this.callback_pending_ = true;
setTimeout(function() { setTimeout(function() {
this.callback_pending_ = undefined; this.callback_pending_ = undefined;
this.callback_(); this.callback_();
}.bind(this), 25); }.bind(this), 500);
} }
}; };