Hello @Henrik Vlijter
Thanks for reaching out to us, could you please share more details like the error message and logs?
Without further details, I would high recommend your raising a support ticket for this issue and investigate this issue further with support engineer. Please share the support ticket number once you create it, please also let us know if you have no support plan, I am happy to enable you a free ticket for this issue.
To answer the question generally, to handle long-running tasks like do_task()
in your Flask application hosted on Azure without encountering the "504.0 GatewayTimeout" error, you need to implement an asynchronous processing approach.
Azure Functions is a serverless compute service that allows you to run event-driven code without managing infrastructure. For long-running tasks, you can leverage Azure Durable Functions or background processing techniques:
- Azure Durable Functions: Suitable for orchestrating workflows and managing long-running tasks. You can break down
do_task()
into smaller steps and manage its execution flow. - Background Processing with Azure Functions: Use Azure Storage Queues or Azure Service Bus queues to decouple your web application from
do_task()
. The web application enqueues a message to triggerdo_task()
asynchronously.
I hope this helps.
Regards,
Yutong
-Please kindly accept the answer if you feel helpful to support the community, thanks a lot.