From 0bd014cfd63d35874706096e256a46414606d2a3 Mon Sep 17 00:00:00 2001 From: Peter Goodman Date: Tue, 6 Jun 2017 03:37:07 +1200 Subject: [PATCH] Actually flush measurements batch when batch size is reached. (#93) This was resulting in ever increasing batches being sent and not resetting the batch when the max batch size is reached. --- lib/librato.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librato.js b/lib/librato.js index 7ef9321..84f176b 100644 --- a/lib/librato.js +++ b/lib/librato.js @@ -286,7 +286,7 @@ var flushStats = function libratoFlush(ts, metrics) { // Post measurements and clear arrays if past batch size if (measurements.length >= maxBatchSize || writeToLegacy && counters.length + gauges.length >= maxBatchSize) { postMetrics(measureTime, gauges, counters, measurements); - if (measurements >= maxBatchSize) { + if (measurements.length >= maxBatchSize) { measurements = []; } if (counters.length + gauges.length >= maxBatchSize) {