1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

fix error on empty metrics

This commit is contained in:
sveisvei 2016-10-27 20:51:39 +02:00 committed by Ivar Conradi Østhus
parent b5e2563bbb
commit 5b41bf4b84

View File

@ -1,4 +1,5 @@
'use strict'; 'use strict';
const POLL_INTERVAL = 10000; const POLL_INTERVAL = 10000;
module.exports = class UnleashClientMetrics { module.exports = class UnleashClientMetrics {
@ -14,7 +15,9 @@ module.exports = class UnleashClientMetrics {
addMetrics (metrics) { addMetrics (metrics) {
metrics.forEach(m => this.metrics.push(m)); metrics.forEach(m => this.metrics.push(m));
this.highestIdSeen = this.metrics[this.metrics.length - 1].id; if (this.metrics && this.metrics.length > 0) {
this.highestIdSeen = this.metrics[this.metrics.length - 1].id;
}
} }
startPoller () { startPoller () {