We have the following scenario:
- Our UI is giving the users the option of running their tasks periodically e.g. once in every hour, once in every 12 hours or once a day, etc. The backend that runs the tasks is an Azure timer-triggered function but it spawns periodically based on the configuration defined in the environment variables:
[Function("JobRunner")]
public Task RunAsync([TimerTrigger("%RunningCron%")] MyInfo myTimer)
{
_logger.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
_logger.LogInformation($"Next timer schedule at: {myTimer.ScheduleStatus?.Next}");
//Do something
return Task.CompletedTask;
}
The value of "%RunningCron% is constant, and as stated earlier it's coming from environment variables e.g. local.settings.json file, etc.
How can we make the CRON value picked up from the database where the user's choice is stored.