Msg.stop support in node-red-node-daemon

Here is a PR that adds support for a stop message (msg.stop) which will kill suspend restarting the process. it also makes the msg.start message trigger a restart as per existing docs.

first contribution so please feel free to give guidance on whatever ..

also i did not see any existing unit tests so no additional ones supplied yet.

Hi. So how does this differ to the existing msg.kill option to stop the process ?

different in that it sets a flag so that the process will not respawn via the redo timer loop.(cleared by a subsequent msg.start)

I didn't want to mess w/ existing kill behavior and this seemed in keeping with separate messages for start,kill as opposed to some combined behavior.

I was confused by the existing start behavior as it did not agree with the doc that says about causing a restart of the running process.

Anyway, happy for any suggestion or request on how to modify it..

I am using this PR version successfully to selectively start/stop a salt-minion process and no issues encountered so far.

Are there relevant unit tests in this space that I missed?

Thanks for reviewing it.

-G

in the node - if you deselect the relaunch option then msg.kill will stop the process and it won't automatically restart, and will wait for a msg.start. Likewise if you deselect the autostart it won't start on deploy and will wait for a msg.start message.

So I'm still not seeing what extra capability this is adding yet...

@dceejay Slightly off topic but, I was using the node-red-node-daemon node today and had a look through the code and saw that it may support a msg.cr property as a boolean. I'm I correct in assuming that the property can be used to "Add [enter] to a message sent"? I couldn't find anything about it in the nodes help documentation and solved my issue without it anyway but would be nice to clarify for future projects.

I want the managed process to restart typically, so that option is selected at flow creation time,

However, during runtime, a user action, or some other event, may indicate that service needs to be stopped and later may need to be re-enabled.

So I need the restart behavior controllable via message during runtime. This new feature gives that kind of control. Am I missing some other way?

thanks,
-G

i can find any link to node-red-contrib-daemon .. but the standard one - node-red-node-daemon has that feature supported in the ui.. and it is maintained as node.cr in the code..

what is the other one you mention?

*can't find

Ah - ok - I get it now... I'll look at the PR with that understanding.

No - the node does not support use of msg.cr - It is a property of the node (node.cr) - that is set at edit time whether to add a cr to each line sent or not. It's can't be changed during runtime via a message.

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