node-red-contrib-questdb 0.6.29 → 0.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -231,7 +231,8 @@ module.exports = function (RED) {
231
231
 
232
232
  // Track rows and flush at threshold
233
233
  connection.rowCount++;
234
- if (connection.flushRows && connection.rowCount >= connection.flushRows) {
234
+ if (connection.flushRows && connection.rowCount >= connection.flushRows && !connection.flushing) {
235
+ connection.flushing = true;
235
236
  try {
236
237
  await connection.sender.flush();
237
238
  connection.rowCount = 0;
@@ -248,8 +249,10 @@ module.exports = function (RED) {
248
249
  connection.connect();
249
250
  }
250
251
  sendError(msg, flushErrMsg);
252
+ connection.flushing = false;
251
253
  return;
252
254
  }
255
+ connection.flushing = false;
253
256
  }
254
257
 
255
258
  var label = type + ': ' + String(castedValue);
package/nodes/questdb.js CHANGED
@@ -106,6 +106,7 @@ module.exports = function (RED) {
106
106
  rowCount: 0,
107
107
  emitter: new EventEmitter(),
108
108
  lastError: null,
109
+ flushing: false,
109
110
  lastNotConnectedLog: 0,
110
111
  lastFlushErrorLog: 0,
111
112
 
@@ -177,6 +178,8 @@ module.exports = function (RED) {
177
178
  connectionState.flushTimer = setInterval(async () => {
178
179
  if (!connectionState.connected || !connectionState.sender) return;
179
180
  if (connectionState.rowCount === 0) return;
181
+ if (connectionState.flushing) return;
182
+ connectionState.flushing = true;
180
183
  try {
181
184
  await connectionState.sender.flush();
182
185
  connectionState.rowCount = 0;
@@ -193,6 +196,8 @@ module.exports = function (RED) {
193
196
  connectionState.sender = null;
194
197
  connectionState.connect();
195
198
  }
199
+ } finally {
200
+ connectionState.flushing = false;
196
201
  }
197
202
  }, flushInterval);
198
203
 
@@ -577,7 +582,8 @@ module.exports = function (RED) {
577
582
 
578
583
  // Track rows and flush at threshold
579
584
  connection.rowCount++;
580
- if (connection.flushRows && connection.rowCount >= connection.flushRows) {
585
+ if (connection.flushRows && connection.rowCount >= connection.flushRows && !connection.flushing) {
586
+ connection.flushing = true;
581
587
  try {
582
588
  await connection.sender.flush();
583
589
  connection.rowCount = 0;
@@ -594,8 +600,10 @@ module.exports = function (RED) {
594
600
  connection.connect();
595
601
  }
596
602
  sendError(flushErrMsg);
603
+ connection.flushing = false;
597
604
  return;
598
605
  }
606
+ connection.flushing = false;
599
607
  }
600
608
 
601
609
  node.status({ fill: 'green', shape: 'dot', text: `sent: ${tableName}` });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-questdb",
3
- "version": "0.6.29",
3
+ "version": "0.6.30",
4
4
  "description": "Node-RED nodes for writing high-performance time-series data to QuestDB using Influx Line Protocol (ILP). Supports IoT, industrial monitoring, smart buildings, fleet telematics, healthcare, agriculture, and more.",
5
5
  "author": {
6
6
  "name": "Holger Amort"