We have multiple automation scripts (SRM Profile Load Scripts) that are trying to set the same parameters on the same element at the same time which causes troubles.
Currently we're using this as locking mechanism:
private static ConcurrentDictionary<string, object> lockDictionary = new ConcurrentDictionary<string, object>();
var lockObject = lockDictionary.GetOrAdd(mainElementId, (key) => new object());
lock (lockObject)
{
//do your sets
}
However this only works within the same SLAutomation process => if the scripts are running from the same DMA. In case of a cluster environment, how can I make sure that profile load scripts that are running on different DMAs are waiting for each other before making sets to the element?
Didn't test this yet, but another approach that might work is to let the script lock the elements it needs. Probably you'll need to call another subscript with the elements as input.