We are seeing some unexpected behavior when a rule executes taskMonitor.updateProgress. The in-memory configuration of an altered Microsoft Active Directory application gets saved over the version in the database.
I think this method must be saving anything cached in memory when it executes. Is that expected behavior, a side effect?
Details: The application has 14 domains configured. The code knows which domain to search, and is processing several batches of accounts sorted by domain. So, we get the application, narrow down the options, do the work and repeat for each group. We do this for groups of accounts in different domains, referring back to the original applicationās settings each time, and selecting the correct domainSettings to match the accounts being processed.
This works as expected until we insert a progress progress report via the monitorās updateProgress method between each pass. At this point the altered configuration gets saved to the database.
Pragmatically, once we narrowed down the behavior, we proactively decache the application right before reporting progress, then get a new reference to it afterwards.
Weād like to understand what is going on, and whether this is a signal that weāre doing something wrong. Our worry is that perhaps a similar thing is happening to other objects in scenarios where the consequences might be more subtle. Which in turn may be causing some insidious bug that we have yet to uncover.
I have broken the data into batches of about 200 accounts. For each batch the code ensures the Application is decached, calls updateProgress, alters the application, Aggregates the batch, then decaches the modified Application.