[Function("TimerTrigger_EveryMinute")]
public async Task TimerTrigger_EveryMinute(
[TimerTrigger("0 * * * * *")] TimerInfo timerInfo,
[DurableClient] DurableTaskClient starter)
{
_logger.LogError($"Running timer trigger");
string instanceId = await starter.ScheduleNewOrchestrationInstanceAsync("ORCHESTRATOR_TRIGGER_NAME");
await starter.WaitForInstanceCompletionAsync(instanceId);
_logger.LogInformation($"Completed orchestration with ID = '{instanceId}'");
}
[Function("ORCHESTRATOR_TRIGGER_NAME")]
public async Task Run(
[OrchestrationTrigger] TaskOrchestrationContext context)
{
//long running function
await Task.WhenAll(response);
}
**what i need:-
1)after calling Orchestration i need timeout at 30sec,so after timeout it should end/exit.
or
2)is there any way we can do timeout for this WaitForInstanceCompletionAsync().**
2
Answers
Thanks for your answer. What if there are more than one ActivityTrigger,will it work?. I provided more code below.
After calling the Orchestration function, you can set the timeout to 30 seconds in the following way-
You can refer to this ms docs for more details.
You can also set the timeout at function level by adding
{ "functionTimeout": "00:00:30" }
in thehost.json
file.