# Inject after Restart?

**URL:** <https://discourse.nodered.org/t/inject-after-restart/95348>\
**Category:** General\
**Created:** [12 February 2025 14:12 UTC](https://discourse.nodered.org/t/inject-after-restart/95348 "2025-02-12T14:12:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [12 February 2025 14:12 UTC](https://discourse.nodered.org/t/inject-after-restart/95348/1 "2025-02-12T14:12:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 February 2025 14:27 UTC](https://discourse.nodered.org/t/inject-after-restart/95348/2 "2025-02-12T14:27:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [12 February 2025 14:43 UTC](https://discourse.nodered.org/t/inject-after-restart/95348/3 "2025-02-12T14:43:22Z")

</div>

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.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 February 2025 15:06 UTC](https://discourse.nodered.org/t/inject-after-restart/95348/4 "2025-02-12T15:06:50Z")

</div>

I suspect that it fires, the debug panel contents are cleared out and the editor screen is drawn, in that order.

You could try changing the delay to 2 seconds, 5 seconds to see if it makes a difference.

---

<div class="post-metadata">

**Author:** ![lorccan](https://avatars.discourse-cdn.com/v4/letter/l/278dde/32.png) [@lorccan](https://discourse.nodered.org/u/lorccan)\
**Post date:** [12 February 2025 16:36 UTC](https://discourse.nodered.org/t/inject-after-restart/95348/5 "2025-02-12T16:36:30Z")

</div>

You're absolutely right. On my system at least 3 seconds was the winner! Thanks again.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 February 2025 16:36 UTC](https://discourse.nodered.org/t/inject-after-restart/95348/6 "2025-02-26T16:36:52Z")

</div>

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