There is some rule, I use everywhere with parallel processing:
Set async after flag on every last task of parallel threads, before parallel joint.
This rule leads, that your own code always be successful, because commit leads to stop before join. And you tell engine… Try yourself solve this, not through my own code.
Actually engine solves this super good :)) I see no optimistic locking messages at all on all parallel threads in all my models