3
votes

Let's say I have a webapp in Azure that auto deploys a continuous webjob. This webapp also has a production and staging slot, and the site deploys to staging, after which a swap happens (manually or automatic) to move the latest into the production slot.

Further, let's assume that the production webjob is running and processing and generally doing it's job before the swap begins. When the deployment to staging happens, the latest webjob does not start because of the WEBJOBS_STOPPED = 1 configuration setting that is honored.

However, after the swap completes, does the webjob that was previously in production and now is in staging continue running? If not, how does it stop? When does it stop? When does the WEBJOBS_STOPPED flag begin to be honored when a running webjob is moved from a production slot to a staging slot?

I can't have the two webjobs running at the same time and it's unclear what the behavior around a swap is... Continuous singletons are easy using the is_singleton property in the webjob settings, but "vertical" webjobs running at the same time around a swap doesn't appear to be clearly understood or documented.

1

1 Answers

6
votes

The key is to make WEBJOBS_STOPPED=1 a slot setting on Staging, so that it is always set for the Staging and never for Production. This will guarantee that you don't have both running at the same time (other than potentially for a few seconds during swap transition).

See this post for some deeper information on how swapping works.