Parallell block role updates

Hey,

We have created a system for updating user roles based on a users “User Group”. Each employee is connected to one user group object, which contains a set of booleans that dictate which modules a user has access to.

So we have this action for updating the user roles. It checks each of the booleans and then adds/removes roles from that (very clunky, but it’s the only solution I found). I used to be able to run this action in a parallell block (picture 1). However, now I get these errors with MongoServerErrors (picture 2) and the action only runs if I put the block in sequential mode. This results in the action taking 3.5 seconds per user in the group.

Is there a way to fix this? Alternatively, do you have advice for a more elegant solution?


Hi!

Parallell execution is only intended for special cases where the operations inside are totally independend of each other. This is not the case in this setup, and I guess it may have worked by coincidence. It should be changed to sequential execution.

However, it looks like the logic would perform 2 operations if changed to sequential execution. Are you sure it is these 2 “Update user account” operations that take 3.5 seconds? That sounds too much and a timing we have never seen before on those type of operations.

Ok I see. No the action originally runs the “Update user account” action for every role type, so it tries to remove a role even though the user does not have it. The action node runs 9 times and this takes ~3.4 seconds.
I changed the action to only run the “Update user account”-action if the user actually has the role that should be removed. So now it uses 0.8 seconds per user when removing one role and adding another.

We’re planning on giving users multiple roles through these “User groups”, and use that to give them access to different modules in our app. However this is a little difficult because of the static selection in the “Update user account” action node. Should we maybe solve this in a different way, or do you have any tips for dynamically changing mulitple roles with a single action node?

Hi,

We do not have dynamic data binding in the Role selection of the Update User Account. However, since you may have “Role” as a data type, I cannot see why you should not have that option. So, registering a challenge on it, but it will probable take a while to implement. So, you would need to assign each role with seperate IFs and Update User Account action nodes (instead of just 1 “Update User Account” assigning multiple roles from the data)

Ok I see, thanks for the tip