Do not execute Timer Trigger in Azure Functions Deployment Slots (other than production)
Currently Timer Trigger still execute in Deployment Slots, which renders them useless for any Functions containing Timer Triggers, because you will then have two running instances.
As I understood the slots, their intention is to make the deployment as seemless as possible. So if I have to stop the slot auto-manually (CI/CD) after the swap, I might stop a running function in the middle of something. If I dont, I will have effectively two running instances of the same Azure Functions, doing everything twice.
So could it be possible to have Timer Triggers not be exectuted when the Function runs not in the production slot?
Thanks for the request! We recommend folks disable functions in the environment they don’t want it to run. Here is our guidance to do that: https://docs.microsoft.com/en-us/azure/azure-functions/disable-function#:~:text=How%20to%20disable%20functions%20in%20Azure%20Functions%201,3%20Other%20methods.%20...%204%20Next%20steps.
This work-around is not a very good one because if the non-Production slot has its functions disabled then after a swap the production functions will be disabled and the non-Production slot will have its functions enabled. That means every deploy will involve enabling and disabling a number of functions. That essentially breaks any sort of CI/CD workflow.
Conceptually the non-production slot is "off", no tiggers should fire against it and that should include timer triggers.