add limit for adjusted time.
This commit is contained in:
parent
b9369412d2
commit
8b3db92bbf
@ -21,6 +21,7 @@ var assert = utils.assert;
|
|||||||
* @param {Number} [limit=200]
|
* @param {Number} [limit=200]
|
||||||
* @property {Array} samples
|
* @property {Array} samples
|
||||||
* @property {Object} known
|
* @property {Object} known
|
||||||
|
* @property {Number} limit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function AdjustedTime(limit) {
|
function AdjustedTime(limit) {
|
||||||
@ -34,6 +35,7 @@ function AdjustedTime(limit) {
|
|||||||
|
|
||||||
this.samples = [];
|
this.samples = [];
|
||||||
this.known = {};
|
this.known = {};
|
||||||
|
this.limit = limit;
|
||||||
this._checked = false;
|
this._checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ AdjustedTime.prototype.add = function add(host, time) {
|
|||||||
var sample = time - utils.now();
|
var sample = time - utils.now();
|
||||||
var i, median, match, offset;
|
var i, median, match, offset;
|
||||||
|
|
||||||
if (this.samples.length >= 200)
|
if (this.samples.length >= this.limit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.known[host])
|
if (this.known[host])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user