Process instance username taken errors

we have a process model to evaluate that runs when we get a request from an integration. We are having a problem For the addition of multiple groups to the same user.

Two process instances are generated simultaneously to add a user to different groups, and when one process instance checks if the user name is taken then it proceeds to create the user and the user is created, simultaneously other process instance is created for the same user to add the user to a different group at the same time. 

 

So when process instance A adds the user 1 to group 'a'  then process instance B is getting stuck because the username is taken by process instance A and it cannot proceeds as the node was false while checking is username taken.

 

We are getting this error because multiple process instances are triggered at the same time hence leading to an issue.

Can we give a 30 seconds timer for process instance A to completed before triggering process Instance B

Any help would be much appreciated. 

  Discussion posts and replies are publicly visible