Deploy vs. restart Node-RED

Not sure if this came up before. We have a small problem because a restart of Node-RED does not behave the same way as a deploy when it comes to ui elements.

Restart: msg will pass through node-red-dashboard : ui_slider after startup.
Full deploy: msg will not pass through ui_slider after deploy.

Is there a way to force some sort of a restart if the deploy button is pressed? Or am I missing something?

Most common solution is to use the ui_control node.

If you do deploy - the dashboard will (re)connect and the ui_control will fire msg. No matter the msg content, you can take it as event. the flow downstream from this node should be able to collect latest state what is needed to be sent to the dashboard nodes.

It works also when you see the dashboard from some other device - new connections is made and the ui_control again fires the msg. Dashboard elements will always have up to date state at the moment you open the page (or switch the dashboard tabs or refresh the page)

Thanks @hotNipi. I should have been more clear about what we're trying to do.

On startup, the msg is being passed through the slider node (dashboard does not have to be open). However, if I do a re-deploy, the msg is not being passed through the slider. The additional message or the different behaviour caused a bug which we only recently discovered because the behaviour is not the same.

Btw, can you explain your username hotNipi? :wink:

Ok. It is not best practice to have dashboard nodes in between of logical flows.
Also - the deploy procedure should not be taken as trigger. The inject node triggers at the startup because you have configured it to do so. (I can see small number 1)

The story of my username is as long as boring so I leave it for days filled with nothing ..

1 Like

Yes, it looks like we have to redesign this but there are so many ui elements :expressionless:

Well, that's how we develop atm and we made some wrong assumptions I guess. A restart after each change did not seem necessary. The inject triggers after deploy as well btw.

I cannot ask more questions atm .. because I am busy bending wires.

True for full deploy, if you do partial deploy and the inject node is not "dirty" there will be silence.
And when project size goes up, you just don't wont to do full deploy every time. Which means _ deploy is not trigger.

In my defence, we are not using a deploy as trigger but expect same behaviour during a startup. Ironically, the problem we have right now is because the slider triggers something but should not.

As you mentioned, we have to isolate the slider, which makes things more complicated.

I am curious, how would you design this?

Well, I said it is not best practice but in many cases it is necessary to do that way. By knowing nothing about the thing you are working on, cant say much more.

I don't think the slider is the main source of the issue. Dashboard nodes may get replay messages when you deploy - that may introduce undesired triggers. It depends on many things which are not under your control directly.
But you definitely need to figure out some sort of solid trigger to initialize the flow at the time you'll need to be started.

So far I have not experienced this and it would not be a problem. But during startup there were now two triggers. The one from inject passing through the slider node and the "real" startup-trigger to initialize everything, whereas after a deploy the message is not being passed through the slider node (as explained in the initial post).

And I am probably not the only one who expects a full or even partial deploy to behave like a full restart. The fact that this is not the case, makes developing more difficult and the slider problem seems like a bug (slider state is not being reset after a deploy). But maybe I don't get the concept of deploy here.

As for the problem I am facing, it was rather easy to fix it. I just need to disable passing messages:
image

IMHO the description above should be "If msg arrives on input, pass through to output (only if the value of payload is not the same as the value stored in the slider node).

Problem solved.

1 Like

Hehe @dceejay are you running a bot which marks everything as "Solution" if a post contains "Problem solved"? Can I borrow your flow? Happy weekend btw.

1 Like

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