You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling TerminateInstanceAsync() in dotnet-isolated (and probably inprocess too) on an orchestration ID that is scheduled to run in the future, the logging reports that the instance was terminated, but it remains in the Pending state and will still run after it's scheduled date.
Expected behavior
Terminating a scheduled orchestration should move it to the Terminated state and prevent it from running when it was scheduled.
Actual behavior
Terminating a scheduled orchestration logs that the terminate operation was unsuccessful, but has no effect on the orchestration.
Relevant source code snippets
[Function("TerminateInstance")]publicstaticasyncTask<HttpResponseData>Run([HttpTrigger(AuthorizationLevel.Anonymous,"get","post")]HttpRequestDatareq,[DurableClient]DurableTaskClientclient,stringinstanceId){stringreason="Long-running orchestration was terminated early.";try{awaitclient.TerminateInstanceAsync(instanceId,reason);returnreq.CreateResponse(HttpStatusCode.OK);}catch(RpcExceptionex){varresponse=req.CreateResponse(HttpStatusCode.BadRequest);response.Headers.Add("Content-Type","text/plain");awaitresponse.WriteStringAsync(ex.Message);returnresponse;}}[Function("HelloCities_HttpStart_Scheduled")]publicstaticasyncTask<HttpResponseData>HttpStartScheduled([HttpTrigger(AuthorizationLevel.Anonymous,"get","post")]HttpRequestDatareq,[DurableClient]DurableTaskClientclient,FunctionContextexecutionContext,DateTimescheduledStartTime){ILoggerlogger=executionContext.GetLogger("HelloCities_HttpStart");varstartOptions=newStartOrchestrationOptions(StartAt:scheduledStartTime);// Function input comes from the request content.stringinstanceId=awaitclient.ScheduleNewOrchestrationInstanceAsync(nameof(HelloCities),startOptions);logger.LogInformation("Started orchestration with ID = '{instanceId}'.",instanceId);// Returns an HTTP 202 response with an instance management payload.// See https://learn.microsoft.com/azure/azure-functions/durable/durable-functions-http-api#start-orchestrationreturnawaitclient.CreateCheckStatusResponseAsync(req,instanceId);}
Known workarounds
Waiting until the orchestration begins running to terminate it.
Description
When calling TerminateInstanceAsync() in dotnet-isolated (and probably inprocess too) on an orchestration ID that is scheduled to run in the future, the logging reports that the instance was terminated, but it remains in the Pending state and will still run after it's scheduled date.
Expected behavior
Actual behavior
Relevant source code snippets
Known workarounds
Waiting until the orchestration begins running to terminate it.
App Details
Latest Durable worker extension **1.2.2/dotnet-isolated/FunctionsV4
The text was updated successfully, but these errors were encountered: