Facts:
- Many struggle with problems to start NR, when a sub-module is crashing, because most of those are not well/safely written. (Without proper
try-catch
.) Even "NR's built-in" modules, like 35-arduino. - If NR is starting as a service, the users do not know how to start NR manually.
- Most users do not know about the:
node-red --safe
switch. - Even if started with
--safe
mode, If the user does not know, what was (accidentally?) changed before pressing the DEPLOY button > it won't help.
That's why I strongly suggest to make NR start process safer by
Auto-Load last stable Flow!
Let's call this new built-in feature: autoLoadLastFlow
or aulolast
To disable it: node-red --unsafe
(for developers, to test crash scenarios.)
How it would work?
-
If the user deploys a flow, first a backup would be made, before saving / overwriting the current flow.
[{flowname}.stable]
. (Except if the file already exists.) -
While starting NR, each flow would start in a
try..catch
part, and if any unhandled error appears (which would normally crash NR) :- The loading process would rename the current flow to
[{flowname}.unsafe]
- If there is already an
.unsafe
file present, it would disable the current flow, and not load it. Set flagunsafeAlreadyExists = true
- Rename back the
[{flowname}.stable]
to be the "normal" one - Set a flag
restoredLastStable = true
to visually show a popup for the user once it started. - Restart the whole loading process from the beginning.
- The loading process would rename the current flow to
-
Else >> If loading was successfull, it would delete
[{flowname}.stable]
file. -
After NR starts, the user would be informed with a popup warning and could choose to:
- Keep the old = restored = currently loaded flow,
and delete the newer[{flowname}.unsafe]
= unstable one?
OR - Load the new,
[{flowname}.unsafe]
flow for further editing?
(Would keep the old, stable file)
- Keep the old = restored = currently loaded flow,
.