Running separate thread in Azure functions works around the timeout limit?

Salazar, Jaime 21 Reputation points

I think that by starting a separate thread inside my Azure function I am inadvertently but successfully breaking past its 10 min functionTimeout limit.

For context, I'm within the free 12 months you get when you first sign up for Azure Functions. I believe that is essentially the Consumption plan in trial mode, so my functions have a timeout limit of 10 mins. In addition, you may know that when you call an Azure function from a Power Automate flow or from Azure DevOps, you have a maximum of 120 and 60 seconds, respectively, for the function to respond back to the caller. This lead me to insert a threading.Thread() (it is a Python function) in main() such that the function responds immediately and yet the actual process can continue to run.

Out of curiosity it then ocurred to me to add a sleep(900) (15 mins for example) in my process, which is running in the separate thread, and see if the function would still hit the 10 min timeout. Apparently it has been able to run for 15 minutes without getting shut down by Azure. I have to assume that either I'm not understanding the timeout correctly or I am somehow sidestepping a pretty hard limit that Microsoft has imposed. Obviously I'm not trying to cheat Microsoft out of a premium plan so I wanted to confirm if what I'm doing is allowed or if I'm abusing the platform somehow.

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