Search code examples
azureazure-webjobsazure-webjobs-triggered

Azure Scheduled Web job is triggering twice sometimes


We have an Azure WebJob which is scheduled to run at 8:00 AM UTC daily(CRON - 0 00 08 * * *).Most of the days it is triggering correctly but on some days it is triggering twice (Second run is occurring ~10 secs after first run ). I can see in the web job history that when it triggered twice,first run's trigger property(from WebJob History JSON) is showing as "External - " and second run trigger property is showing as "Schedule - 0 0 8 * * *" but we don't have any external services triggering this WebJob.

When i checked the Job scheduler log for more details, "Web Job Invoked" status is only present for those days when the webjob got triggered twice.


Solution

  • Your problem appears to be that you appear to have two different things triggering your WebJob:

    1. You probably have a settings.job (wiki) with a cron expression.
    2. You may also have an Azure Scheduler Job Collection hitting your WebJob from the outside (possibly with a different schedule, which is why they don't always match).

    Suggestion is to get rid of #2, and only keep the internal WebJobs scheduling via settings.job.