Schedule something for 2 hours in future?

Hey,

Wondering if anyone has a solution to this.

So I have an event that when fires uses a timeout node to countdown for 2 hours before I need to turn off the device. It works fine, but the problem with any timeout that is longer than a few minutes is, that if I deploy in the meantime, or restart the server etc, the timeout is lost.

So what I need is a persistent timeout (like using a data store in the change mode), or a way to dynamically create an inject node or something that fires at a certain time (and then gets deleted).

What's the best way to handle this?

I'm thinking that I could set the finish time (now + 2 hours) to a persistant data store, through change, and set up an inject that fires after deploy / start that reads that, sees if a timer was active, and if so resets the timer with (end time - now). Should work, but wondering if there's a better solution I'm missing.

Thanks

I think you have already solved your problem! Think about how to implement it!

There are some “fun” edges cases to this sort of problem, but the basic principle is right.

Or you could use cron-plus and configure it dynamically for the right time. Would have to cope with being switched off over the time it should trigger though

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