As part of my Advent of Code efforts, I'm having to be creative in splitting messages
In Day 3, I need to split a message into two equal parts so I'm using a switch to add msg.complete after half the number of messages have passed
However, I'm finding that I have to stick a superfluous change node in as well otherwise the messages arrive out of order.
Can someone explain why this is happening without the extra change node - is it just timiing? And if so - is there a better way of ensuring correct order of messages arriving at the join?
[{"id":"273b95be5f0a745f","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"b41a0bea9b144b3a","type":"junction","z":"273b95be5f0a745f","x":840,"y":180,"wires":[["86e060fbfa932ea5","0dc5f6c75011bcbf","7901ee4977a08814"]]},{"id":"1dd4fa914ea28353","type":"split","z":"273b95be5f0a745f","name":"","splt":" 1","spltType":"len","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":270,"y":160,"wires":[["8cfe1f4b84945ba0"]]},{"id":"8cfe1f4b84945ba0","type":"switch","z":"273b95be5f0a745f","name":"","property":"parts.index","propertyType":"msg","rules":[{"t":"eq","v":"index1","vt":"msg"},{"t":"eq","v":"index2","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":410,"y":160,"wires":[["8194868092e2cd12"],["8194868092e2cd12"],["dfec8efbf4635efc"]]},{"id":"8194868092e2cd12","type":"change","z":"273b95be5f0a745f","name":"","rules":[{"t":"set","p":"complete","pt":"msg","to":"true","tot":"bool","dc":true}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":140,"wires":[["b41a0bea9b144b3a"]]},{"id":"86e060fbfa932ea5","type":"debug","z":"273b95be5f0a745f","name":"complete msg object","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1080,"y":120,"wires":[]},{"id":"0dc5f6c75011bcbf","type":"debug","z":"273b95be5f0a745f","name":"msg.parts.index","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"parts.index","targetType":"msg","statusVal":"","statusType":"auto","x":1060,"y":240,"wires":[]},{"id":"8fe9703b7e8a1271","type":"inject","z":"273b95be5f0a745f","name":"","props":[{"p":"payload"},{"p":"index1","v":"2","vt":"num"},{"p":"index2","v":"5","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"abcdef","payloadType":"str","x":110,"y":160,"wires":[["1dd4fa914ea28353"]]},{"id":"dfec8efbf4635efc","type":"change","z":"273b95be5f0a745f","name":"","rules":[{"t":"delete","p":"complete","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":200,"wires":[["b41a0bea9b144b3a"]]},{"id":"7901ee4977a08814","type":"join","z":"273b95be5f0a745f","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1030,"y":180,"wires":[["0eef0a3a2ae1e8f9"]]},{"id":"0eef0a3a2ae1e8f9","type":"debug","z":"273b95be5f0a745f","name":"split messages","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1220,"y":180,"wires":[]}]