Carlos Alves Jorge
Carlos Alves Jorge

Reputation: 1985

How to define timeout per function in host.json?

I have many functions and most of them I want to have a timeout of 30 seconds. Yet there is one where the timeout needs to be about 2.30 min.

Is there a way to configure hosts.json to reflect that?

Upvotes: 6

Views: 3603

Answers (2)

MarkXA
MarkXA

Reputation: 4384

It's not possible within a single function app. However, you should be able to split the 2:30 function out into a separate function app. If it's an HTTP triggered function then use Azure Functions Proxies on the main app to forward the endpoint to the new app.

Upvotes: 2

Boris Wilhelms
Boris Wilhelms

Reputation: 661

This seems to be not possible via the host.json file. According to the documentation the timeout is set for all functions

Indicates the timeout duration for all functions.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout

But it maybe possible with durable functions timer.

Durable Functions provides durable timers for use in orchestrator functions to implement delays or to set up timeouts on async actions.

https://learn.microsoft.com/en-us/azure/azure-functions/durable-functions-timers#usage-for-timeout

Upvotes: 0

Related Questions