Workshop On Module Loads Race Conditions

Hi,

I have a potential use-case that I think will depend on how workshop will schedule the function calls it makes. Let me give a notional example:

  • I have one function that takes an object set, does some calculations, & returns a value (myValue1)
  • I have another function that also takes an object set, does some calculations, & returns a value (myValue2)
  • I want to be able to save these values in an object property, which is a JSON string. So that property should look like:
{'val1' : myValue1, 'val2': myValue2}

I know how to do this if a user clicks a button, but I would like all of this to be done on module load if possible.

I think I know how to set this up, but the question is if the inner workings of how workshops dispatches the function calls on module load will result in race conditions that will cause issues here.

If the myValue1 & myValue2 function can load that object’s JSON string property & append its value, is there a world where the myValue2 function will ‘interrupt’ the myValue1 function & only one edit will apply? Does workshop have a ‘locking’ mechanism when running functions to prevent concurrent edits?

Thanks!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.