Search code examples
c#azure-webjobsazure-web-app-serviceazure-webjobs-continuous

my continous webjob published to multiple app services will only run for one of the app services a day instead running per cron schedule


I have a c# webjob that has two functions. One is a blobtrigger, the other is TimerTrigger("0 */2 * * * *").

I published the webjob (via visual studio) to each of the appservices (all in the same resource group using the same blobstorage.)

I expected that each one of these would "trigger" every 2 minutes. Instead what is happening is only one of my webjobs will run for the day, the rest of the appservices go without a webjob run for the whole day.

In the azure-webjobs-host timer log there is only this one line:

{"Last":"2020-01-31T20:00:00.0030602+00:00","Next":"2020-01-31T20:02:00+00:00","LastUpdated":"2020-01-31T20:00:00.0030602+00:00"}

Any idea on why the webjob isn't running in the other appservices?


Solution

  • 2 issues:

    1. Having multiple blob triggers meant anyone of the app services could service it. I really only need one blobtrigger per container.

    2. The triggered function was not run and block, so blob.ExistsAsync would take to long to return. So I made the Job async Task, use JobHost.CallAsync and then Wait();