Support concurrent recv and get_event (#345)
This PR fixes a race condition when multiple workflow instances are waiting on `recv` or multiple callers are waiting on `get_event`. The solution is to maintain a thread safe map. - For `recv`, only one workflow instance should be waiting, because `recv` consumes messages. If a workflow is already waiting for `recv`, directly raise a `DBOSWorkflowConflictIDError` and wait for the existing workflow to finish. - For `get_event`, multiple callers can wait on the same event. In this case, we maintain a reference counter and only delete the condition variable when nobody is waiting. - Add unit tests for concurrent recv and get_event.
Q
Qian Li committed
752569da99bae2becc509415ff023cda70da02f9
Parent: 327eb0a
Committed by GitHub <noreply@github.com>
on 5/9/2025, 4:07:47 AM