From a7bcd12bc31b0490e4879eaea52c7fe3bc418d2d Mon Sep 17 00:00:00 2001 From: Massimo Candela Date: Tue, 14 Jan 2020 02:51:12 +0100 Subject: [PATCH] fix issue with empty batches in connector --- src/connectors/connector.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/connectors/connector.js b/src/connectors/connector.js index 909f1a7..b21dd87 100644 --- a/src/connectors/connector.js +++ b/src/connectors/connector.js @@ -71,10 +71,12 @@ export default class Connector { _sendBatch = () => { clearTimeout(this.timerBatch); delete this.timerBatch; - const msg = this.name + "-" + '[' + this.batch.join(',') + ']'; - this.batch = []; - if (this.messageCallback) - this.messageCallback(msg); + if (this.batch.length) { + const msg = this.name + "-" + '[' + this.batch.join(',') + ']'; + this.batch = []; + if (this.messageCallback) + this.messageCallback(msg); + } }; _message = (message) => {