Skip to content

Commit 9cc94d0

Browse files
authored
Update performance-reliability.md
Update with a recommendation to wait for all tasks/callbacks/processes before returning from a function
1 parent 88301b4 commit 9cc94d0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

articles/azure-functions/performance-reliability.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ A function can become large because of many Node.js dependencies. Importing depe
2020

2121
Whenever possible, refactor large functions into smaller function sets that work together and return responses fast. For example, a webhook or HTTP trigger function might require an acknowledgment response within a certain time limit; it's common for webhooks to require an immediate response. You can pass the HTTP trigger payload into a queue to be processed by a queue trigger function. This approach lets you defer the actual work and return an immediate response.
2222

23+
## Background tasks must complete returning from functions
24+
25+
Azure Functions does not track background threads. If your functions initiate any tasks, callbacks, threads, processes, tasks, etc., they must be complete before you return from your functions. If not, you risk site shutdown or other unintended behavior.
26+
27+
For example, if a function kicks off a background task and returns a successful response before the task finishes, the function will be considered successful and complete despite the result of the background task.
28+
2329
## Cross function communication
2430

2531
[Durable Functions](durable/durable-functions-overview.md) and [Azure Logic Apps](../logic-apps/logic-apps-overview.md) are built to manage state transitions and communication between multiple functions.

0 commit comments

Comments
 (0)