586837r / node-red-contrib-ring-buffer

MIT License
2 stars 0 forks source link

Enabling "Send only if full" option results in an error with every input message #2

Open shimbone opened 4 years ago

shimbone commented 4 years ago

Once the "Send only if full" box has been checked in the properties of the ring buffer node, each subsequent input message results in the error: TypeError: Cannot read property 'full' of undefined.

Node-Red v1.1.3

To reproduce:

  1. Import the example flow found below OR import the Testing Example flow found in the projects README.md file, open the properties of the ring buffer node found within that flow and enable the "Send only if full" option .
  2. Deploy the imported flow.
  3. Activate any of the injection nodes from the imported flow: a:1 - c:3.

Result: The payload of the injected node will not be added to the buffer's array as expected. Instead the ring buffer node will generate the error described above.

//- The Testing Example flow with the send only if full option enabled:

[{"id":"802ed4a1.695ad8","type":"debug","z":"9a3a99bb.d9f938","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":280,"wires":[]},{"id":"d9fb6218.eaf4c","type":"ring-buffer","z":"9a3a99bb.d9f938","name":"","capacity":"5","order":"old-to-new","sendOnlyIfFull":true,"pushAfterClear":true,"extra":true,"perTopic":true,"x":520,"y":280,"wires":[["802ed4a1.695ad8"]]},{"id":"8f80d2a9.c74c2","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a","payload":"1","payloadType":"num","x":250,"y":80,"wires":[["d9fb6218.eaf4c"]]},{"id":"6b4bb47a.f513ec","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a","payload":"2","payloadType":"num","x":250,"y":120,"wires":[["d9fb6218.eaf4c"]]},{"id":"aef20094.c3367","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a","payload":"3","payloadType":"num","x":250,"y":160,"wires":[["d9fb6218.eaf4c"]]},{"id":"1e02abb8.58f8a4","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"b","payload":"1","payloadType":"num","x":250,"y":240,"wires":[["d9fb6218.eaf4c"]]},{"id":"f1541883.588398","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"b","payload":"2","payloadType":"num","x":250,"y":280,"wires":[["d9fb6218.eaf4c"]]},{"id":"6f2ab901.89d088","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"b","payload":"3","payloadType":"num","x":250,"y":320,"wires":[["d9fb6218.eaf4c"]]},{"id":"824f4638.e101e8","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"c","payload":"1","payloadType":"num","x":250,"y":400,"wires":[["d9fb6218.eaf4c"]]},{"id":"9c5f9ee2.d7cef","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"c","payload":"2","payloadType":"num","x":250,"y":440,"wires":[["d9fb6218.eaf4c"]]},{"id":"4c05e6a4.de5cb8","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"c","payload":"3","payloadType":"num","x":250,"y":480,"wires":[["d9fb6218.eaf4c"]]},{"id":"2aeae71e.e3f6d8","type":"change","z":"9a3a99bb.d9f938","name":"","rules":[{"t":"set","p":"clearAll","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":100,"wires":[["d9fb6218.eaf4c"]]},{"id":"f147dc10.d5a3d","type":"change","z":"9a3a99bb.d9f938","name":"","rules":[{"t":"set","p":"clear","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":140,"wires":[["d9fb6218.eaf4c"]]},{"id":"655a38e7.9acf88","type":"function","z":"9a3a99bb.d9f938","name":"","func":"msg.topic = Math.random();\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":560,"wires":[["d9fb6218.eaf4c"]]},{"id":"7623f774.9b2288","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":100,"wires":[["2aeae71e.e3f6d8"]]},{"id":"d3ce324b.b306d","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a","payload":"","payloadType":"date","x":470,"y":140,"wires":[["f147dc10.d5a3d"]]},{"id":"eb45cdfe.a4d52","type":"inject","z":"9a3a99bb.d9f938","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":560,"wires":[["655a38e7.9acf88"]]}]
llh258021686 commented 2 years ago

Send only if full "TypeError: Cannot read property 'full' of undefined"