Guest theringe Posted August 31, 2022 Posted August 31, 2022 Function App under at least a Premium plan could have unlimited execution time. However, it might caused a duplicated invocation issue with a ServiceBus trigger because the "PeekLock" duration is up to 5 minutes (including renew). It is a tutorial to reproduce such the scenario. STEP 1: In Azure portal, create a new Premium python Function App and a Service Bus + Queue STEP 2: Download the sample code and apply some changes. https://cchlab.blob.core.windows.net/cchlab/cchlabsbf.zip In "host.json", please specify the Function App timeout and the ServiceBus PeekLock timeout as below. In "ServiceBusQueueTrigger1/function.json", please setup some configuration: SBQ_STRING=<your service bus queue name> Then, deploy the project to Function App. STEP 3: Making an experiment with a short execution time. Visit: https://<YourAppName>.azurewebsites.net/api/httptrigger1?t=<DurationInSecond> Please specify the "DurationInSecond" to 30 this time, and you may see the result like this: We apply this operation to send a message to the ServiceBus queue and told the ServiceBus trigger to pause 30 seconds before execution. Now, please go to the monitor page: You can see it is just a normal short invocation. STEP 4: Making an experiment with a long execution time. Visit: https://<YourAppName>.azurewebsites.net/api/httptrigger1?t=<DurationInSecond> Please specify the "DurationInSecond" to 330 this time, and you may see the result like this: Now, please go to the monitor page: As you can see, there are duplicate invocations with the same message id, which might caused some potential business issues if we ignore them. Conclusion: Since we cannot adjust "maxAutoRenewDuration" to more than 5 minutes, we could only reduce the execution time from this ServiceBus trigger. Continue reading... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.