Can a function node detect when re-deployed?

#1

I'm thinking that the answer is no but just checking

Simon

0 Likes

#2

Hi Simon,

Isn't the close event what you are looking for?

Bart

0 Likes

#3

I was looking to restore the status text - now that I can use Blockly to set it :slight_smile: - when a re-deploy takes place

0 Likes

#4

The Close event tells you when the node is being closed, but there is no equivalent event in the Function node for when it is created as part of a deploy.

Maybe there should be....

1 Like

#5

For a function node (basically a flow) just add an inject node that triggers once. That can run into a function node which updates what you need.

0 Likes

#6

The inject once node is I think a good and adequate solution to the detecting a flow startup, even as a complete node-red newbie it was obvious to me as a way to do it and I, perhaps mistakenly, assumed it was the reason for the inject once option. But with the addition of persistent across restart storage, I think a "flow is stopping" hook would be essential to insure that persistent storage gets flushed properly.

0 Likes

#7

Yes - that's the workaround I'm currently using

0 Likes

#8

Node red will look after that for you, you don't need to worry about it.

0 Likes