Skip to content

Commit 438ce96

Browse files
authored
Add note that instances termination is asynchronous
Related to Azure/azure-functions-durable-extension#1193 It is not clear from the documentation that the `TerminateAsync` API does not immediately terminate an instance. This PR adds a paragraph clarifying the behavior.
1 parent d52ce8a commit 438ce96

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

articles/azure-functions/durable/durable-functions-instance-management.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func durable get-instances --created-after 2018-03-10T13:57:31Z --created-before
351351

352352
If you have an orchestration instance that is taking too long to run, or you just need to stop it before it completes for any reason, you have the option to terminate it.
353353

354-
You can use the `TerminateAsync` (.NET) or the `terminate` (JavaScript) method of the [orchestration client binding](durable-functions-bindings.md#orchestration-client) to terminate instances. The two parameters are an `instanceId` and a `reason` string, which are written to logs and to the instance status. A terminated instance stops running as soon as it reaches the next `await` (.NET) or `yield` (JavaScript) point, or it terminates immediately if it's already on an `await` or `yield`.
354+
You can use the `TerminateAsync` (.NET) or the `terminate` (JavaScript) method of the [orchestration client binding](durable-functions-bindings.md#orchestration-client) to terminate instances. The two parameters are an `instanceId` and a `reason` string, which are written to logs and to the instance status.
355355

356356
# [C#](#tab/csharp)
357357

@@ -386,6 +386,8 @@ See [Start instances](#javascript-function-json) for the function.json configura
386386

387387
---
388388

389+
A terminated instance will transition into the `Terminated` state. However, this transition will not happen immediately. Rather, the terminate operation will be queued in the task hub along with other operations for that instance. You can use the [instance query](#query-instances) APIs to know when a terminated instance has actually reached the `Terminated` state.
390+
389391
> [!NOTE]
390392
> Instance termination doesn't currently propagate. Activity functions and sub-orchestrations run to completion, regardless of whether you've terminated the orchestration instance that called them.
391393
@@ -794,4 +796,4 @@ func durable delete-task-hub --task-hub-name UserTest
794796
> [Learn how to handle versioning](durable-functions-versioning.md)
795797
796798
> [!div class="nextstepaction"]
797-
> [Built-in HTTP API reference for instance management](durable-functions-http-api.md)
799+
> [Built-in HTTP API reference for instance management](durable-functions-http-api.md)

0 commit comments

Comments
 (0)