Lol, 10 months and no feedback? Did you find any solution to this issue?
After Swap Azure Function with CosmosDBTrigger Continues Firing On Slot that was Swapped Out
I've got a function app that is configured as follows:
- It has a production slot and a slot called staging (i.e. normal slot setup)
- One of the functions has a CosmosDBTrigger
- Another of the function is a StatusCheck function used to delay swapping detailed here (https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-zero-downtime-deployment#status-check-with-slot)
In production using Azure release pipeline I deploy a new version as follows:
- Deploy new version of code to slot
- Wait for StatusCheck to return isRunning = false
- Swap
Actual: The staging slot (i.e. that now has the "old" code) takes over. More specifically the CosmosDBTrigger on the staging slot appears to be "stealing" the Cosmos updates. If I stop the staging slot then the CosmosDBTrigger on the production slot wins out.
Expectation: That the production slot (i.e. the one with the "new" code) takes over without having to stop the staging slot
Am I missing anything here is there any configuration I need to modify to get the production slot (i.e. new code) CosmosDBTrigger to take over. I would assume the same type of deal applies to other triggers as well.
Thanks
2 answers
Sort by: Most helpful
-
-
Dongyong Li 0 Reputation points Microsoft Employee
2023-09-15T08:09:41.7433333+00:00 Hi Steve, I met the same problem and it takes me a while to understand the logic.
First, slot traffic router will not control the ComsmosDBTrigger message, becuase it is not Http.
Second, when two azure function runs and they subscribe to the same container, the one which first start will take control, and process the change. It is recored in lease container, the fields is "Owner".
To solve this problem when deploying with slots, disable the function in the settings, and make is sticky to slots. Or you can use different lease prefix for different slots.
example:
set AzureWebJobs.xxxYourFunctionxxx.Disabled to false for production slot and true for staging slot.