# \[UPDATE\] node-red-semaphore-plus 3.1.0

**URL:** <https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620>\
**Category:** Share Your Nodes\
**Tags:** semaphore\
**Created:** [5 November 2023 13:32 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620 "2023-11-05T13:32:48Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 November 2023 13:32 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/1 "2023-11-05T13:32:48Z")

</div>

After a discussion under the below thread with @cymplecy

> [@I'm after (I think anyway) a rate limited gate](https://discourse.nodered.org/t/im-after-i-think-anyway-a-rate-limited-gate/82615):
>
> So end result required Messages arrive and I want them rate limited (at least 1/sec) to give upstream nodes a chance to deal with them But I want the messages to be gated, so that if upstream nodes take 2s - the next message isn't released until told to do so by a control message Does my requirement make sense? And has anyone already done something like this?

node-red-semaphore-plus **3.1.0** is now available.

**New Features**

- You can now reset the lock (which will dispose of all messages)  
To do this, send a property of `msg.smp_reset = true` to the `Release` Node

**Changes**

- The color and shape of the status in the `Take` Node, now denotes whether or not a message will be queued, where a dot denotes if this `Take` has queued messages, and a ring denotes that it does not.

Enjoy

> **[@marcus-j-davies/node-red-semaphore-plus](https://flows.nodered.org/node/@marcus-j-davies/node-red-semaphore-plus)**
>
> An advanced set of semaphore Nodes for Node RED, with a dynamic fail-safe

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2023 13:48 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/2 "2023-11-05T13:48:56Z")

</div>

> [@marcus-j-davies](#):
>
> The color and shape of the status in the `Take` Node, now denotes whether or not a message will be queued, where a dot denotes if this `Take` has queued messages, and a ring denotes that it does not.

Works very nicely - good scheme 🙂

The release node doesn't quite follow exactly (i.e. no green ring when not going to queue next message)

> [@marcus-j-davies](#):
>
> You can now reset the lock

Of course, I didn't read the instructions and just tried msg.reset = true - which failed of course

Worked fine when I sent correct message but AFAIK all other NR nodes that accept reset msgs just use msg.reset so I'd suggest just using that (as who has time to read instructions/documentation???) 🙂

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 November 2023 13:59 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/3 "2023-11-05T13:59:06Z")

</div>

> [@cymplecy](#):
>
> The release node doesn't quite follow exactly (i.e. no green ring when not going to queue next message)

I was in 2 minds about this one 😄  
Given **Release** / **FS Reset** won't be queuing anything, I think I customised the status shapes more for `Take` Nodes as their queue stats can differ from each other

> [@cymplecy](#):
>
> but AFAIK all other NR nodes that accept reset msgs just use msg.reset

Yup, was also at a cross road, as all nodes passthrough the `msg` and didn't want to step on other nodes toes so to speak, that also use `msg.reset` but then I'm portably too kind 😅

Presently, I'll keep it as the prefixed `smp_` as there are a few other magic properties that can control behaviour like setting the fail-safe timeout in a message.. example: `smp_failsafeTimeout`

But will keep it in mind.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2023 14:02 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/4 "2023-11-05T14:02:59Z")

</div>

I think the unwritten rule of the other nodes is that if a msg.reset is received, they clear their internal state and don't output anything so no propagation occurs

So 1st node to get the reset wins 🙂

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 November 2023 14:08 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/5 "2023-11-05T14:08:19Z")

</div>

> [@cymplecy](#):
>
> I think the unwritten rule of the other nodes is that if a msg.reset is received, they clear their internal state and don't output anything so no propagation occurs

Thats a very good point \<walks around living room, thinking\> 😄

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 November 2023 15:11 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/6 "2023-11-05T15:11:57Z")

</div>

@cymplecy I'm going to play devils advocate

`msg.reset` - Reset state and **don't** forward the `msg` to adhere to the 'norm' 😃  
`msg.smp_reset` - Reset state only

Explanation:

The **Semaphore Release** Node can also be used to reset the entire queue state, this will result in all queued message being dropped.

Setting a message property `smp_reset = true` will achieve this. If you wanted to stop the message containing this command from propagating, use `reset` instead of `smp_reset`

Thoughts?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2023 16:02 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/7 "2023-11-05T16:02:16Z")

</div>

I "think" you saying yes to msg.reset into the release node will drop all messages at the take node and reset queue state to non-queued

And nothing will come out of the release node

Which is what I believe is the norm

But you going to keep existing (well since this afternoon anyway) msg.smp\_reset to do the same as 1st paragraph but be sent on from the release node

Have I got this right?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 November 2023 16:03 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/8 "2023-11-05T16:03:48Z")

</div>

Correct!

I'm about to push a release in a few mins, as I saw a minor issue (since fixed)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [5 November 2023 16:25 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/9 "2023-11-05T16:25:32Z")

</div>

3.2.0 pushed

**New Features**

- Add support for `msg.reset` to stop message propergation on the `Release` node

**Fixes**

- Check if a permit is undefined before executing an atomic Release

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2023 17:42 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/10 "2023-11-05T17:42:00Z")

</div>

V3.2.0 working fine for me

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [6 November 2023 10:14 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/11 "2023-11-06T10:14:53Z")

</div>

One (more) thing

If I change the fail-safe  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfb20e86cbd31b02cd339897761189d3cdafafa1.png)

when I press deploy - the status is not updated to reflect new value

This causes me to go back into the node to check that I've set it correctly

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [6 November 2023 11:42 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/12 "2023-11-06T11:42:29Z")

</div>

Hi @cymplecy,

The LFS status shows what the _current_ LFS is, as it can change during flow activity (or more accurately, when a message has passed through) it’s at that time, the FS is actually applied and ticking down so to speak

I.e once a message is allowed through, it shows what LFS is currently applied

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [6 November 2023 11:52 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/13 "2023-11-06T11:52:48Z")

</div>

But if I edit a node and set a value and deploy node, does that value not become the current LFS?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [6 November 2023 12:05 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/14 "2023-11-06T12:05:19Z")

</div>

The FS that is set on the node, is the default that _will_ be applied, when a message passes through, unless you override it of course with the magic property.

As the FS is global, I think what I am aiming to show is what the current / active LFS (last) is.

What I can show is another value perhaps, what the default is (as set in the node properties) , as well as the current FS that is currently enforced.

This should show what your default value is

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [6 November 2023 12:20 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/15 "2023-11-06T12:20:15Z")

</div>

In fact I like this idea

DFS - default fail safe (for this take/fs reset node)  
LFS - last fail safe applied (what is currently active)

I’m in B’Ham today - so will have a play once home

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [6 November 2023 12:28 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/16 "2023-11-06T12:28:49Z")

</div>

Just throwing this out as it's used in quite a few nodes

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/04ae96d1260160e5b0d6c7be7741e4b0ad88a4d8.png)

where - if you don't specify a node name, it puts some of the node field info into the node name

This would save overloading (even more) the status

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [6 November 2023 18:49 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/17 "2023-11-06T18:49:21Z")

</div>

Ok @cymplecy,

I think I have found the sweet spot.

**LQ** - Local Queue Size  
**GQ** - Global Queue Size  
**DFS** - Default Fail-Safe (for this **Take** or **Reset** node) - i.e what is set on the Node it's self  
**LAFS** - Last Active Fail-Safe

I am not using the node label currently, but may do in the future.  
I am now using vertical bars to separate the stats, I think its much clearer when reading.

![Screenshot 2023-11-06 at 18.47.34](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/5/b512b15a9f970fb637a8173ee349db985f5ed844.png)

thoughts?

**EDIT:**  
The node setting label has also been updated

![Screenshot 2023-11-06 at 18.49.35](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ec0a8c5201c29c059a920fa6e49d1cf9056a3f64.png)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [6 November 2023 21:00 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/18 "2023-11-06T21:00:33Z")

</div>

Looks OK 🙂

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [7 November 2023 20:18 UTC](https://discourse.nodered.org/t/update-node-red-semaphore-plus-3-1-0/82620/19 "2023-11-07T20:18:39Z")

</div>

3.3.0 Released.

**New Features**

- Both the `Take` and `FS Reset` Nodes, now includes a new output property.  
`smp_appliedFailsafe` This denotes what fail-safe was applied for this `msg` allowing reference to the current fail-safe time.  
You can, for example, use its value to decide on an updated fail-safe time, for the current message

**Changes**

- Improvements to the node Status.
- Improvements to node help, and **README**

> **[@marcus-j-davies/node-red-semaphore-plus](https://flows.nodered.org/node/@marcus-j-davies/node-red-semaphore-plus)**
>
> An advanced set of semaphore Nodes for Node RED, with a dynamic fail-safe
