node-red-contrib-questdb 0.6.28 → 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
 
@@ -162,8 +163,10 @@ module.exports = function (RED) {
162
163
  // v4.x: Sender.fromConfig() is now async
163
164
  connectionState.sender = await Sender.fromConfig(connStr);
164
165
 
165
- // Wait for TCP transport to be fully ready
166
- await new Promise(resolve => setTimeout(resolve, 5000));
166
+ // Wait for TCP transport to be fully ready (HTTP doesn't need this)
167
+ if (configNode.protocol === 'tcp' || configNode.protocol === 'tcps') {
168
+ await new Promise(resolve => setTimeout(resolve, 5000));
169
+ }
167
170
 
168
171
  connectionState.updateState(true);
169
172
 
@@ -175,6 +178,8 @@ module.exports = function (RED) {
175
178
  connectionState.flushTimer = setInterval(async () => {
176
179
  if (!connectionState.connected || !connectionState.sender) return;
177
180
  if (connectionState.rowCount === 0) return;
181
+ if (connectionState.flushing) return;
182
+ connectionState.flushing = true;
178
183
  try {
179
184
  await connectionState.sender.flush();
180
185
  connectionState.rowCount = 0;
@@ -191,6 +196,8 @@ module.exports = function (RED) {
191
196
  connectionState.sender = null;
192
197
  connectionState.connect();
193
198
  }
199
+ } finally {
200
+ connectionState.flushing = false;
194
201
  }
195
202
  }, flushInterval);
196
203
 
@@ -575,7 +582,8 @@ module.exports = function (RED) {
575
582
 
576
583
  // Track rows and flush at threshold
577
584
  connection.rowCount++;
578
- if (connection.flushRows && connection.rowCount >= connection.flushRows) {
585
+ if (connection.flushRows && connection.rowCount >= connection.flushRows && !connection.flushing) {
586
+ connection.flushing = true;
579
587
  try {
580
588
  await connection.sender.flush();
581
589
  connection.rowCount = 0;
@@ -592,8 +600,10 @@ module.exports = function (RED) {
592
600
  connection.connect();
593
601
  }
594
602
  sendError(flushErrMsg);
603
+ connection.flushing = false;
595
604
  return;
596
605
  }
606
+ connection.flushing = false;
597
607
  }
598
608
 
599
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.28",
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"