node-red-contrib-questdb 0.6.23 → 0.6.25

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.
@@ -237,7 +237,11 @@ module.exports = function (RED) {
237
237
  connection.rowCount = 0;
238
238
  } catch (flushErr) {
239
239
  var flushErrMsg = formatError(flushErr, { operation: 'flush', table: tableName });
240
- RED.log.error('[QuestDB] Flush failed: ' + flushErrMsg);
240
+ var flushNow = Date.now();
241
+ if (flushNow - connection.lastFlushErrorLog > 5000) {
242
+ connection.lastFlushErrorLog = flushNow;
243
+ RED.log.error('[QuestDB] Flush failed: ' + flushErrMsg);
244
+ }
241
245
  if (isDisconnectionError(flushErr)) {
242
246
  connection.updateState(false, flushErr.message);
243
247
  connection.sender = null;
package/nodes/questdb.js CHANGED
@@ -107,6 +107,7 @@ module.exports = function (RED) {
107
107
  emitter: new EventEmitter(),
108
108
  lastError: null,
109
109
  lastNotConnectedLog: 0,
110
+ lastFlushErrorLog: 0,
110
111
 
111
112
  // Method to update state and emit event
112
113
  updateState: function (newStatus, error = null) {
@@ -179,7 +180,11 @@ module.exports = function (RED) {
179
180
  connectionState.rowCount = 0;
180
181
  } catch (flushErr) {
181
182
  const flushErrMsg = formatError(flushErr, { operation: 'auto-flush' });
182
- RED.log.error(`[QuestDB] Flush failed: ${flushErrMsg}`);
183
+ var now = Date.now();
184
+ if (now - connectionState.lastFlushErrorLog > 5000) {
185
+ connectionState.lastFlushErrorLog = now;
186
+ RED.log.error(`[QuestDB] Flush failed: ${flushErrMsg}`);
187
+ }
183
188
  connectionState.emitter.emit('flushError', flushErr);
184
189
  if (isDisconnectionError(flushErr)) {
185
190
  connectionState.updateState(false, flushErr.message);
@@ -528,19 +533,7 @@ module.exports = function (RED) {
528
533
  } else if (typeof value === 'boolean') {
529
534
  connection.sender.booleanColumn(key, value);
530
535
  } else if (typeof value === 'string') {
531
- // Check if it's an ISO date string
532
- if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(value)) {
533
- const dateValue = new Date(value);
534
- if (!isNaN(dateValue.getTime())) {
535
- // Convert to microseconds for QuestDB
536
- const microSeconds = BigInt(dateValue.getTime()) * 1000n;
537
- connection.sender.timestampColumn(key, microSeconds);
538
- } else {
539
- connection.sender.stringColumn(key, value);
540
- }
541
- } else {
542
- connection.sender.stringColumn(key, value);
543
- }
536
+ connection.sender.stringColumn(key, value);
544
537
  } else if (value instanceof Date) {
545
538
  // Convert to microseconds for QuestDB
546
539
  const microSeconds = BigInt(value.getTime()) * 1000n;
@@ -591,7 +584,11 @@ module.exports = function (RED) {
591
584
  connection.rowCount = 0;
592
585
  } catch (flushErr) {
593
586
  const flushErrMsg = formatError(flushErr, { operation: 'flush', table: tableName });
594
- RED.log.error(`[QuestDB] Flush failed: ${flushErrMsg}`);
587
+ var flushNow = Date.now();
588
+ if (flushNow - connection.lastFlushErrorLog > 5000) {
589
+ connection.lastFlushErrorLog = flushNow;
590
+ RED.log.error(`[QuestDB] Flush failed: ${flushErrMsg}`);
591
+ }
595
592
  if (isDisconnectionError(flushErr)) {
596
593
  connection.updateState(false, flushErr.message);
597
594
  connection.sender = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-questdb",
3
- "version": "0.6.23",
3
+ "version": "0.6.25",
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"