Durable Functions and Consumption plan pricing

Ron Pitts 20 Reputation points
2023-05-19T09:36:25.6966667+00:00

The timeout limit is 10 minutes, does this apply to Durable functions as well? e.g. Timer for 5 hours wake up

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,925 questions
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2023-05-22T05:13:17.7066667+00:00

    Ron Pitts Thanks for reaching out. Yes, the timeout limit of 5 applies to Durable Functions as well. By default, the maximum duration of a single function execution in Azure Functions is 10 minutes. This includes Durable Functions. The same is documented here.

    By default, functions running in the Consumption plan have a timeout of five minutes. If this limit is exceeded, the Azure Functions host is recycled to stop all execution and prevent a runaway billing situation. The function timeout is configurable.

    If you need to run a long-running operation in a Durable Function, you can use the DurableOrchestrationContext.CreateTimer method to create a timer that wakes up the function after a specified amount of time. However, the maximum duration of the timer is also limited to 6 days.

    Here's an example of how you can use the DurableOrchestrationContext.CreateTimer method to create a timer that wakes up the function after 5 hours:

    [FunctionName("MyOrchestratorFunction")]
    public static async Task RunOrchestrator(
        [OrchestrationTrigger] DurableOrchestrationContext context)
    {
        // Create a timer that wakes up the function after 5 hours
        DateTime wakeUpTime = context.CurrentUtcDateTime.AddHours(5);
        await context.CreateTimer(wakeUpTime, CancellationToken.None);
    
        // Perform the long-running operation here
        // ...
    }
    
    

    In this example, the DurableOrchestrationContext.CreateTimer method is used to create a timer that wakes up the function after 5 hours. The AddHours method of the DateTime object is used to calculate the wake-up time.

    The same is documented here. Please review the timer limitation here.

    Feel free to get back to me if you have any queries or concerns.

    Please "Accept Answer" if the answer is helpful so that it can help others in the community.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.