I'm attempting to follow the code as an example laid out here, https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-eternal-orchestrations?irgwc=1&OCID=AID2000142_aff_7593_1375745&tduid=(ir__6jtlnbrfc0kft3svkk0sohznxn2xi0sgvpzqs0fg00)(7593)(1375745)()()&irclickid=_6jtlnbrfc0kft3svkk0sohznxn2xi0sgvpzqs0fg00&tabs=csharp, for creating an Eternal Orchestration in Durable Functions.
Currently, I have an HTTP triggered function
[FunctionName("Trigger_Eternal_Orchestration")]
public static async Task<HttpResponseMessage> OrchestrationTrigger(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestMessage request,
[DurableClient] IDurableOrchestrationClient client)
{
string id = request.Query["Id"];
await client.StartNewAsync("Periodic_Cleanup_Loop", instanceId).ConfigureAwait(false);
return client.CreateCheckStatusResponse(request, instanceId);
}
and the orchestration trigger function as
[FunctionName("Periodic_Cleanup_Loop")]
public static async Task Run(
[OrchestrationTrigger] IDurableOrchestrationContext context)
{
DateTime nextCleanup = context.CurrentUtcDateTime.AddSeconds(10);
await context.CreateTimer(nextCleanup, CancellationToken.None);
Console.WriteLine("Going again");
context.ContinueAsNew(null);
}
Right now I'm just trying to see the eternal orchestration work (see the print out every 10 seconds) but after only one execution I always get the error:
Multithreaded execution was detected. This can happen if the orchestrator function code awaits on a task that was not created by a DurableOrchestrationContext method.
I'm not sure what the error is exactly based on the message given that the orchestration function only has one await and it is on something that is created with the context.