Abhi619
Abhi619

Reputation: 47

Azure function misbehaving with multiple http hits at same time

I have created a azure function on powershell which works on http hit . It is writing a JSON file at its root folder after processing it. But if multiple hit occurs at same time then it throws file in use error. I know azure function doesn't work good on multi threading and variables can be modified while running one process and 2nd process occurs. I don't want to use queue storage so any good suggestion how to do it?

Upvotes: 0

Views: 168

Answers (1)

Chris Anderson
Chris Anderson

Reputation: 8505

DO NOT WRITE ANYTHING TO THE AZURE FUNCTIONS FILESYSTEM THAT YOU DO NOT WANT TO LOSE.

Use Cosmos DB or some other external data store to store your data.

Without a code sample, it is hard to say what you might be doing wrong. You should be able to do this fine, from a code point of view, but you need to check if the file is in use and handle errors when it is (i.e. wait or throw a 429 error/etc.)

Upvotes: 1

Related Questions