Forgive me if I don't understand elixir really well as I am new to it...
I'm using quantum-elixir as a cron api to dynamically create cron jobs. When someone POSTS to a route I save the cron job details into my Ecto Repo and then simultaneously create a quantum job with Quantum.add_job
.
In development when I close my server and restart it, i have to re-add all my cron jobs because they don't survive through a restart. So that got me thinking that if my application were to crash that would make me lose all the cron jobs. (I'm thinking about of scenarios where I host the app on Google compute engine and for whatever reason need to do a reset on the compute instance, ie upgrades on the box, etc.)
So I was wondering what the appropriate way to restart my app is while keeping these cron jobs?
Right now I have the following:
worker(Task,[MyApp.RebootTask, :reboot, []], restart: :transient)
in the start
function of my application module.
Is this the right approach? What other considerations do I need to factor in?
Any guidance is greatly appreciated