node-red-contrib-questdb 0.6.1 → 0.6.3

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.
Files changed (2) hide show
  1. package/nodes/questdb.js +30 -2
  2. package/package.json +1 -1
package/nodes/questdb.js CHANGED
@@ -364,8 +364,22 @@ module.exports = function (RED) {
364
364
  connection.sender.at(timestampMicros);
365
365
  }
366
366
  } catch (tsErr) {
367
+ // Check if it's a transport connection error
368
+ if (tsErr.message && tsErr.message.includes('TCP transport is not connected')) {
369
+ node.error('TCP transport disconnected, reconnecting...', msg);
370
+ connection.updateState(false, tsErr.message);
371
+ return; // Don't complete the row, let reconnection handle it
372
+ }
367
373
  node.error(formatError(tsErr, { operation: 'timestamp', table: tableName }), msg);
368
- connection.sender.atNow(); // Complete the row to avoid buffer corruption
374
+ try {
375
+ connection.sender.atNow(); // Complete the row to avoid buffer corruption
376
+ } catch (cleanupErr) {
377
+ // If even cleanup fails, log and trigger reconnection
378
+ if (cleanupErr.message && cleanupErr.message.includes('TCP transport is not connected')) {
379
+ node.error('TCP transport disconnected during cleanup, reconnecting...', msg);
380
+ connection.updateState(false, cleanupErr.message);
381
+ }
382
+ }
369
383
  }
370
384
  } else {
371
385
  // QuestDB format: payload.symbols + payload.columns
@@ -488,8 +502,22 @@ module.exports = function (RED) {
488
502
  connection.sender.at(timestampMicros);
489
503
  }
490
504
  } catch (tsErr) {
505
+ // Check if it's a transport connection error
506
+ if (tsErr.message && tsErr.message.includes('TCP transport is not connected')) {
507
+ node.error('TCP transport disconnected, reconnecting...', msg);
508
+ connection.updateState(false, tsErr.message);
509
+ return; // Don't complete the row, let reconnection handle it
510
+ }
491
511
  node.error(formatError(tsErr, { operation: 'timestamp', table: tableName }), msg);
492
- connection.sender.atNow(); // Complete the row
512
+ try {
513
+ connection.sender.atNow(); // Complete the row
514
+ } catch (cleanupErr) {
515
+ // If even cleanup fails, log and trigger reconnection
516
+ if (cleanupErr.message && cleanupErr.message.includes('TCP transport is not connected')) {
517
+ node.error('TCP transport disconnected during cleanup, reconnecting...', msg);
518
+ connection.updateState(false, cleanupErr.message);
519
+ }
520
+ }
493
521
  return; // Early return - don't continue with potentially bad data
494
522
  }
495
523
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-questdb",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
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"