Why not set it in a subflow then you can have configurable inputs to, as in this example set to 5 messages in 10 seconds
[{"id":"43d574be.4067ac","type":"subflow","name":"limit time count","info":"","category":"","in":[{"x":160,"y":140,"wires":[{"id":"737efd96.8c5ce4"}]}],"out":[{"x":460,"y":160,"wires":[{"id":"737efd96.8c5ce4","port":0}]}],"env":[{"name":"time","type":"num","value":"3600000","ui":{"type":"input","opts":{"types":["num"]}}},{"name":"limit","type":"num","value":"10","ui":{"label":{"en-US":"limit"},"type":"input","opts":{"types":["num"]}}},{"name":"name","type":"str","value":"limit1","ui":{"label":{"en-US":"name"},"type":"input","opts":{"types":["str"]}}}],"color":"#DDAA99"},{"id":"737efd96.8c5ce4","type":"function","z":"43d574be.4067ac","name":"","func":"const time = env.get(\"time\");\nconst limit = env.get(\"limit\");\nconst name = env.get(\"name\");\nconst millis = new Date().valueOf()\nlet stored = flow.get(`limit_count.${name}`) || {\"time\": 0, \"count\": 0};\n\nif(stored.time < millis - time){\n stored = {\"time\": millis, \"count\": 1};\n}else{\n stored = {\"time\": stored.time, \"count\": stored.count+1};\n}\nflow.set(`limit_count.${name}`, stored)\n\nif (stored.count > limit) msg = null;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":140,"wires":[[]]},{"id":"65cb04ca.eaf084","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":20,"wires":[["eca4e433.85c7d"]]},{"id":"eca4e433.85c7d","type":"subflow:43d574be.4067ac","z":"c791cbc0.84f648","name":"","env":[{"name":"time","value":"10000","type":"num"},{"name":"limit","value":"5","type":"num"},{"name":"name","value":"limit2","type":"str"}],"x":400,"y":20,"wires":[["893d956f.72bd28"]]},{"id":"893d956f.72bd28","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":120,"wires":[]},{"id":"a1e68c60.aa8788","type":"subflow:43d574be.4067ac","z":"c791cbc0.84f648","name":"","env":[{"name":"time","value":"5000","type":"num"},{"name":"limit","value":"2","type":"num"}],"x":390,"y":80,"wires":[["893d956f.72bd28"]]},{"id":"2a0a9c4f.8cfb6c","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":80,"wires":[["a1e68c60.aa8788"]]}]
[edit] I see Trying_to_learn suggested the same.
[edit] updated to store in seperate properties, so the individual use of subflows will write to there own name property. If you use the same name it will count the messages from both flows as one count.