We have an app where we make multiple API calls to an LLM from a list of prompts. When each call returns, their response is added to a single list.
I have seen that, depending on when each call returns, often there are a few responses that don’t get added to the list due to a race condition.
I believe I need something like a mutex/lock object so I can guarantee that each add call is serialized. I had hoped that this would be implemented by bubble behind the scenes, but this isn’t the case.
What are my options here? This seems like very basic behavior for any app where updates to a list can potentially occur at the same time.
Rory