Durable Function orchestrator race condition?
have an Azure Durable Function that is triggered when users send SMS messages. I'm using the function to collect multiple messages if they arrive within a short duration, and create one consolidated message.
The first message triggers the function and calls the start_new method of the durable function orchestrator, subsequent messages raise a new_message event
The issue I'm facing is that if two messages arrive very close, both of them start the orchestrator because the second message arrives before the orchestration for the first message was initialized. So the durable function runtime starts a new orchestration for each message, because of which one of the messages overwrites the other since they both belong to the same orchestration with the same predetermined orchestration id.
Is this a known issue and how can I get around it?
Here's the code I have:
Queue Trigger (run when a new message arrives on a message queue)