Hello community.
My understanding is that only way to setup a recurring periodic job with Oban Workers is to utilize the Oban.Plugins.Cron. Documentation seems to set the configuration on the config.exs. My question is if I use the same container image to deploy to multiple environment servers (test, sandbox, production, etc), won’t this run all the periodic jobs on each the servers?
This is not a desired action in my case because each job will have a notification email info within the args data and will send out the notification even for non-production environment runs. Each environments are deployed with the same container images so will have same configurations (email address).
So far options I have come up with:
- Update the config.exs after deployment to each servers. This is not ideal as each deployment will overwrite the environment specific config.exs.
- Implement a environment value check for all the Workers to only execute on specific envrionments. For example, only call perform function if env_variable is “prod”. I question if this is a good approach to manage all Worker executions this way.
Please let me know if I am missing something here of if you need any additional info. I am open to any suggestions as I am bit stuck at this point.