I'm programming a daemon that periodically expires and deletes resources as part of its normal operation. Cleanup jobs are stored persistently and restarted on program start.
If the program is not restarted and runs for a long time, is it feasible to addTimer a cleanup job to run in e.g. 30 days or so, or will the bog down system resources too much? There might be thousands of timers set eventually.
With thanks to the knowledgable!
Good point, done. Works fine but needs the mentioned file descriptors.
Dang, looks like I'm going to have to resort to chosing a resolution and polling after all, I was hoping for something that only wakes up when needed.
I could do that with one timer that triggers another, but I have no way of canceling it in the case of adding a task that is sooner than all others.
Thanks for the input!
I still don't know if an async future is designed to be waited on for extended periods of time.
They are not designed for this purpose, although it doesn't make them unusable for long periods of time. Usually you want something persistent for long periods of time. See Araq's answer. Another option is to use persistent database and do timer logic there via polling or pub/sub. Designing for a system that never reboots could be naive, usually they do reboot at least sometimes.
Cleanup jobs are stored persistently and restarted on program start.
As described, persistence will be done manually- so after program start task definitions are loaded from persistant storage and run or scheduled.
They are not designed for this purpose, although it doesn't make them unusable for long periods of time.
Great, that's exactly what I needed to know. So it's not crazy but off-label use.
So now I know that, and that and I need to re-use one future. That was everything I needed, along with some possible alternate routes- thank you very much!