I am developing an Azure timer trigger-based function. I want to run it for each 1 min. It's running but it runs a new instance again in the middle of the current function execution (not completed fully). How to make sure only 1 instance should run and after it ends then only the next execution should start (even though the trigger is 1 min)?
CodePudding user response:
As I have checked the Azure Functions Timer Trigger, I'm not getting the new instance for 1 min schedule.
A timer-triggered function is only called once across all instances if a function app scales out to include more than one instance. If there is still an active pending invocation, it won't trigger once again.
How to make sure only 1 instance should run and after it ends then only the next execution should start (even though the trigger is 1 min)?
Basically, this Timer Trigger Function runs on Singleton Lock feature, it ensures that only 1 instance is running.
Refer to this GitHub issue where the user reported the similar issue that the Azure Timer Triggered Functions running multiple instances at the same time and fixed the issue.