public async Task Run([TimerTrigger("%InactiveDeviceReminderCron%")] TimerInfo myTimer, ILogger log, CancellationToken cancellationToken) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); var query = new GetInactiveProfilesQuery(DateTime.UtcNow, TimeSpan.Parse(Environment.GetEnvironmentVariable("InactiveDeviceReminderCheckInterval"))); var profiles = await mediator.Send(query, cancellationToken); var command = new SendReminderToInactiveDeviceCommand(profiles); await mediator.Send(command, cancellationToken); }
public async Task Run([TimerTrigger("%InactiveDeviceCron%")] TimerInfo myTimer, ILogger log, CancellationToken cancellationToken) { log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); var command = new GetInactiveProfilesQuery(DateTime.UtcNow, TimeSpan.Parse(Environment.GetEnvironmentVariable("CheckInterval"))); var profiles = await mediator.Send(command, cancellationToken); foreach (var profile in profiles) { var notifyCommand = new SendNotificationToInactiveProfileCommand(profile, Environment.GetEnvironmentVariable("InactiveUserMessage")); await mediator.Send(notifyCommand, cancellationToken); } }