thevan
thevan

Reputation: 10364

Restrict Azure timer trigger running from multiple instances

I have an Azure timer trigger function hosted in an App Service plan (I3 : 5).

By default App Service plan instance count has been set to 5.

So whenever timer trigger starts, it is starting from all of the five instances parallelly.

I want to restrict the timer trigger running to a single instance.

I made the below line of code on top of the timer trigger function name:

[Singleton(Mode = SingletonMode.Listener)]

But it is not restricting to single instance. Again timer trigger running in all of the 5 instances.

Appreciate your comments and answers.

Upvotes: 3

Views: 1095

Answers (1)

Julien Jacobs
Julien Jacobs

Reputation: 2654

The documentation clearly says

If a function app scales out to multiple instances, only a single instance of a timer-triggered function is run across all instances. It will not trigger again if there is an outstanding invocation is still running.

If you are observing a different behavior, it may mean that something may have not been setup/configured properly.

Upvotes: 0

Related Questions