Skip to content
Advertisement

In Azure DevOps, how to gracefully restart when deploying an app to Functions

In Azure DevOps Pipeliens, when deploying an app to Functions, the app may restart during the process of the app.

Is there a way to monitor if the Functions app is running in the pipeline, make sure it’s done, and then deploy the app?

Conditions

  • Functions runtime: Java
  • Trigger: Service Bus Trigger

I tried to check the lock status of Service Bus messages or the processing status of the Functions app with the Azure CLI, but it seems that there is no interface to check the processing status.

https://learn.microsoft.com/en-us/cli/azure/functionapp?view=azure-cli-latest https://learn.microsoft.com/en-us/cli/azure/servicebus/queue?view=azure-cli-latest

Advertisement

Answer

You should never rely on that better build your functions to execute fast.

When Azure function sends signal to stop in c# we have CancellationToken this way we can have extra code to implement shutdown, otherwise as soon as AF get signal to stop it will not accept new events from service bus but will continue to execute current functions, and if they wont stop for some time they can be terminated (cant find exact time but will update answer )

I would also suggest you to utilise deployment slots this way you can minimise your downtime.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement