I use file based context storage. I log msg.delay and timestamp in flow vars just before calling the delay [node] . When Node-RED restarts, if the time now is greater than the sum of the stored timestamp and the stored delay, I do nothing otherwise restart the delay for the remaining period.
So far so good. Where I'm having problems is with inject nodes firing on a restart. (Changing something and re-deploying will fire the inject [Inject once after 0.1 seconds] but the restart doesn't.)
Is there some way to overcome this - perhaps by triggering something else on restart rather than an inject node?
My understanding is that inject nodes set to fire once after a short delay will trigger when Node-red restarts, also when a complete deploy is done.
If the node itself is modified (not simply moved) then a partial deploy will also trigger it.
Are you certain your inject node does not fire when NR is restarted?
Is it connected to a debug node?
Try setting the debug output to "System console" and check in the logs.
Well that's interesting. Although I see nothing in the debug GUI, you're right that it does show up as firing in the logs. (I've just got a flow injecting timestamp -> debug for testing purposes.)
I suppose it's something to do with the GUI not being connected to the new backend process(es) or something.