Perhaps something like this will do what you want
[{"id":"a4f83620bc9c7846","type":"function","z":"bdd7be38.d3b55","name":"Queue payloads","func":"let payloads = context.get(\"payloads\") || []\nif (msg._release) {\n // the incoming message includes msg._release true so pass on the payloads\n msg.payload = payloads\n payloads = []\n} else {\n payloads.push(msg.payload)\n msg = null // stop the return from sending a message\n}\ncontext.set(\"payloads\", payloads)\nnode.status({text: `queued: ${payloads.length}`})\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":2920,"wires":[["0abb31cae9c20c03"]]},{"id":"aef84022f34c57bd","type":"inject","z":"bdd7be38.d3b55","name":"Simulated incoming messages 1 per second","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"iso","payloadType":"date","x":270,"y":2880,"wires":[["a4f83620bc9c7846"]]},{"id":"fec86de385320a44","type":"inject","z":"bdd7be38.d3b55","name":"Release every 5 seconds","props":[{"p":"_release","v":"true","vt":"bool"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":300,"y":2980,"wires":[["a4f83620bc9c7846"]]},{"id":"0abb31cae9c20c03","type":"debug","z":"bdd7be38.d3b55","name":"Queued payloads","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":2920,"wires":[]}]