Azure Function Executing Stored Procedure every few seconds

Nathan Sundararajan 1 Reputation point
2020-08-05T15:56:20.06+00:00

We have Azure Functions executing stored procedure every 2 seconds. Most of the time 90% of the time the stored procedure will finish in less than 1 second. But if the json is big and have lots of values some times it runs for more than 2 seconds. I don't want the Azure function to start until the one its running is completed.

    [FunctionName("OrderOIHSync")]
    public static async Task RunSingle([TimerTrigger("*/2 * * * * *")]TimerInfo myTimer, ILogger log)

Is this the right approach or how I can control so in exception cases the azure function don't trigger. Based on documentation timer trigger says singleton but I seen cases where it's triggering and causing some data issues.

Any suggestions appreciated.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,476 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Pramod Valavala 20,601 Reputation points Microsoft Employee
    2020-08-05T17:30:05.293+00:00

    This is the perfect use case for an Eternal Orchestration in Durable Functions that allows you to work around dynamic run times compared to a timer triggered function and also allows for dynamic intervals as you can control how long a function should sleep (or not at all).


  2. Nathan Sundararajan 1 Reputation point
    2020-08-06T23:49:19.997+00:00

    I verified it's singleton and I did re-orchestration to make sure. Also thanks for the explanation of Durable Function. I found about the HTTP trigger also. Since my case was working I decided not to change it to Durable functions.

    0 comments No comments