How force azure function to execute one after other

Valentin GARREAU 21 Reputation points
2022-11-08T09:42:55.48+00:00

Hello.

I have an azure function that sent email to user. My problem is my code is calling many time this azure function and many email are sent to user. To block it i have a notification time variable that prevent user to be spam by notification. But it looks like when my code call azure function, if it call many time they are all executing in same time so the notificaiton variable is not working because it's the same in every azure functions.

There is a way to make an azure function to execute one after the other ? Like that my azure function will have time to read the notification time variable and update it for the next execution.
Like that my process will be : Azure function trigger -> database notification time update -> Next one

I tried to add this to my host.json:

{  
  "version": "2.0",  
  "extensionBundle": {  
    "id": "Microsoft.Azure.Functions.ExtensionBundle",  
    "version": "[1.*, 2.0.0)"  
  },  
  "extensions": {  
    "queues": {  
      "batchSize": 1,  
      "newBatchThreshold": 0,  
      "maxPollingInterval": "00:01:00",  
      "visibilityTimeout": "00:02:00",  
      "maxDequeueCount": 3  
    }  
  },  
  "functionTimeout": "00:10:00"  
}  

But look like the batchsize is not working.
I tried to change scaleout settings but also got error :
258222-image.png

If someone have any idea to help me :) ? Thank you

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