# Rate limiter less than a second?

**URL:** <https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277>\
**Category:** General\
**Created:** [4 January 2024 09:27 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277 "2024-01-04T09:27:09Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [4 January 2024 09:27 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/1 "2024-01-04T09:27:09Z")

</div>

Does the rate limiter in `delay` node accept also decimal values?  
I need to serialize each incoming message in order to avoid overlapping...

 ![Screenshot 2024-01-04 alle 10.23.36](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/2/a252481e49b0a8a3395781cf4e661ea18852a807.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [4 January 2024 09:33 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/2 "2024-01-04T09:33:52Z")

</div>

Pretty sure it does (and certainly easy enough to test).

> [@fmarzocca](#):
>
> I need to serialize each incoming message in order to avoid overlapping

Unless your messages go through a node which does async operation or you branch off, then messages should be in order regardless! What exactly do you mean here?

Perhaps you need a kinda semaphore to prevent executing a node before it has finished?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [4 January 2024 09:42 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/3 "2024-01-04T09:42:23Z")

</div>

> [@Steve-Mcl](#):
>
> What exactly do you mean here?

This is triggered at 01.00. Can I send all the messages to the group without "serializing" them?

 ![Screenshot 2024-01-04 alle 10.41.46](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/9/591452cddfccf84ad017b584a583a9d388af470a.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [4 January 2024 10:06 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/4 "2024-01-04T10:06:36Z")

</div>

> [@fmarzocca](#):
>
> Can I send all the messages to the group without "serializing" them?

Sure, why not? Unless you have side effects in that function node (e.g. it has state or uses context), i see no reason.

You could of course order them by using link-call

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e1ce2b6f887765bb305f743c45bdb834aa9807c8.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 January 2024 13:45 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/5 "2024-01-04T13:45:46Z")

</div>

and behind the scenes 1 msg in 0.1 s is the same as 10 msgs in 1 sec ...

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [4 January 2024 13:58 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/6 "2024-01-04T13:58:59Z")

</div>

> [@dceejay](#):
>
> and behind the scenes 1 msg in 0.1 s is the same as 10 msgs in 1 sec .

Yes. But one by one. Not all at once

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 January 2024 15:24 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/7 "2024-01-04T15:24:04Z")

</div>

> [@fmarzocca](#):
>
> Not all at once

In fact 10 msgs in one second does them one by one too. It has been argued that it should do them all at once, but it doesn't.

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [4 January 2024 15:25 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/8 "2024-01-04T15:25:40Z")

</div>

> [@Colin](#):
>
> In fact 10 msgs in one second does them one by one too. It has been argued that it should do them all at once, but it doesn't.

Ok. But do you think that using that limiter can hurt?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 January 2024 15:44 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/9 "2024-01-04T15:44:36Z")

</div>

In what way would it hurt anything?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [4 January 2024 15:45 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/10 "2024-01-04T15:45:10Z")

</div>

Ok. you answered, Thanks

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [8 January 2024 13:35 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/11 "2024-01-08T13:35:29Z")

</div>

Steve, how would the error handling work in your example? 🤔

AFAIK the `link-call` node doesn't (re-)throw an error if the corresponding `link-return` gets fed with an error message (meaning a msg with `msg.error` set). The only "real" error it throws is the timeout.  
In all other cases, you'd have to _manually_ check for `msg.error` after each `link-call` and perform some error handling.

(Which is why I still prefer using subflows instead of link-calls, because I can make proper use of catch nodes. 🤓)

EDIT: We can move this into a separate topic if you like, because it's slightly off-topic from the original question.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 January 2024 13:41 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/12 "2024-01-08T13:41:23Z")

</div>

> [@kuema](#):
>
> AFAIK the `link-call` node doesn't (re-)throw an error if the corresponding `link-return` gets fed with an error message

correct.

there is ongoing thoughts and discussion around improving the link call.

It can however be handled with methods you discuss. And, personally, the savings that can be made in processing time that it takes to init `instance x subflow nodes` vs a simple check after the link-call, i know what I would chose.

> [@kuema](#):
>
> (Which is why I still prefer using subflows instead of link-calls, because I can make proper use of catch nodes. 🤓)

Have you written this pattern up in any of the discussions (I forget - it is not currently on my radar - please link to it)

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [8 January 2024 14:02 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/13 "2024-01-08T14:02:07Z")

</div>

Good to know it's on the radar. I haven't found any relevant discussion on the matter in the designs repo on Github so far.

I totally agree about the performance issues when using many (nested) subflows. Link-calls would absolutely suffice in most cases.

But I'm also an advocate of clean error handling, and that involves using the try-catch pattern. So porting all of them to link-calls would introduce a lot of extra manual error handling.

If you like, we can start a feature request topic and I'll write up my thoughts on that. (this evening, I have some other tasks at the moment)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 January 2024 14:09 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/14 "2024-01-08T14:09:27Z")

</div>

> [@kuema](#):
>
> If you like, we can start a feature request topic and I'll write up my thoughts on that. (this evening, I have some other tasks at the moment)

there was some talk here: [Capturing errors caused inside link-call flows - #3 by gregorius](https://discourse.nodered.org/t/capturing-errors-caused-inside-link-call-flows/80010/3)

And some design proposals here: [FR: Dynamic Link node enhancement request (backlog item) · Issue #3836 · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues/3836#issuecomment-1295803582) - the design stalled after failing to come to a resolution. I personally like choice (sometimes I want link call to pass msg with error, sometimes i want it to throw) but that was vetoed!

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [8 January 2024 14:21 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/15 "2024-01-08T14:21:21Z")

</div>

Oh boy, I'm getting old. 🥴

I have already mumbled my exact thoughts on the matter in the topic you mentioned, which is using the `.error` property... 🙈

> [@Capturing errors caused inside link-call flows](https://discourse.nodered.org/t/capturing-errors-caused-inside-link-call-flows/80010/9):
>
> Using the .error property as indicator is the only way right now. The link return doesn't (and shouldn't) know anything about the nodes connected, that would make it much more complex. I think it should only react on the message. I think of .error as a convention for errors, just like payload for data. I actually use it that way sometimes to generate an error that is not from a catch node, so I can use the same error handling flow path. In some of my own nodes (request-response paradigm) I us…

And I realize (again), that there's no trivial solution to it, either.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 January 2024 14:22 UTC](https://discourse.nodered.org/t/rate-limiter-less-than-a-second/84277/16 "2024-01-22T14:22:07Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
