I have this function:
[FunctionName("MultipleTimersOrchestrator")]
public async Task<List<string>> RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)
{
var outputs = new List<string>();
log.LogInformation($"Starting process {DateTime.Now}");
DateTime deadline = context.CurrentUtcDateTime.Add(TimeSpan.FromSeconds(5));
await context.CreateTimer(deadline, CancellationToken.None);
log.LogInformation($"Starting GetUser Tokyo {DateTime.Now}");
outputs.Add(await context.CallActivityAsync<string>("GetUser", "Tokyo"));
log.LogInformation($"Ended GetUser Tokyo {DateTime.Now}");
DateTime deadline2 = context.CurrentUtcDateTime.Add(TimeSpan.FromSeconds(10));
await context.CreateTimer(deadline2, CancellationToken.None);
log.LogInformation($"Starting GetUser Seattle {DateTime.Now} ");
await context.CallActivityAsync<string>("GetUser", "Seattle");
log.LogInformation($"Ended GetUser Seattle {DateTime.Now}");
return outputs;
}
My problem is that it is acting weird...Is it possible to have more than a timer awaited in one orchestratror function?
It seems, by the log, that the whole funtion is being executed after 5, and then after 10 seconds. I was expecting it to work like a Task.Delay()
Is that correct?Someone can explain that?
Thanks a lot.