smithtek-mako-rf 1.8.0 → 2.5.0
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.
- package/package.json +1 -1
- package/smithtek-mako-rf-2.5.0.tgz +0 -0
- package/smithtek-mako-rf.html +12 -1
- package/smithtek-mako-rf.js +12 -0
- package/smithtek-mako-rf-1.7.0.tgz +0 -0
package/package.json
CHANGED
|
Binary file
|
package/smithtek-mako-rf.html
CHANGED
|
@@ -274,7 +274,9 @@
|
|
|
274
274
|
|
|
275
275
|
timeout_s: { value: 8, required: true, validate: RED.validators.number() },
|
|
276
276
|
retries: { value: 2, required: true, validate: RED.validators.number() },
|
|
277
|
-
gap_s: { value: 0, required: true, validate: RED.validators.number() }
|
|
277
|
+
gap_s: { value: 0, required: true, validate: RED.validators.number() },
|
|
278
|
+
maxQueue: { value: 50, required: true, validate: RED.validators.number() }
|
|
279
|
+
|
|
278
280
|
},
|
|
279
281
|
label: function () {
|
|
280
282
|
return this.busName || "smithtek mako rf";
|
|
@@ -413,6 +415,15 @@
|
|
|
413
415
|
<div class="form-tips">
|
|
414
416
|
Select a channel. RF is for the LoRa long range radio RTU coms.
|
|
415
417
|
</div>
|
|
418
|
+
<div class="form-row">
|
|
419
|
+
<label for="node-config-input-maxQueue"><i class="fa fa-list"></i> Max queue</label>
|
|
420
|
+
<input type="number" id="node-config-input-maxQueue" min="1" style="width:140px;">
|
|
421
|
+
</div>
|
|
422
|
+
<div class="form-tips">
|
|
423
|
+
The max queue will limmit how many polls can be queued from the connected devices. It will drop the oldest from the queue.
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
|
|
416
427
|
</script>
|
|
417
428
|
|
|
418
429
|
<!-- =========================
|
package/smithtek-mako-rf.js
CHANGED
|
@@ -253,6 +253,7 @@ module.exports = function (RED) {
|
|
|
253
253
|
queue: [],
|
|
254
254
|
busy: false,
|
|
255
255
|
lastPortKey: "",
|
|
256
|
+
maxQueue: 50
|
|
256
257
|
};
|
|
257
258
|
BUS.set(key, s);
|
|
258
259
|
}
|
|
@@ -492,6 +493,7 @@ module.exports = function (RED) {
|
|
|
492
493
|
this.timeout_s = toNum(n.timeout_s, 8);
|
|
493
494
|
this.retries = toNum(n.retries, 2);
|
|
494
495
|
this.gap_s = toNum(n.gap_s, 0);
|
|
496
|
+
this.maxQueue = toNum(n.maxQueue, 50);
|
|
495
497
|
|
|
496
498
|
ensureBusState(this);
|
|
497
499
|
|
|
@@ -573,8 +575,18 @@ module.exports = function (RED) {
|
|
|
573
575
|
if (config.includeWriteQuantity) req.quantity = quantity;
|
|
574
576
|
}
|
|
575
577
|
|
|
578
|
+
const maxQ = clampInt(busCfg.maxQueue, 1, 1000, 50);
|
|
579
|
+
|
|
580
|
+
// If queue is full, drop NEW requests (keeps fairness for the ones already queued)
|
|
581
|
+
if (state.queue.length >= maxQ) {
|
|
582
|
+
try { done(); } catch (_e) {}
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
|
|
576
586
|
state.queue.push({ node, msg, send, done, req, items });
|
|
577
587
|
scheduleProcess(state, busCfg.id);
|
|
588
|
+
|
|
589
|
+
|
|
578
590
|
});
|
|
579
591
|
|
|
580
592
|
node.on("close", function (_removed, done) {
|
|
Binary file
|