Squidex.ClientLibrary: disabled rules still getting triggered during bulk update

Hello,

I have been struggling with an issue when using the Squidex.ClientLibrary to disable rules while I am bulk uploading documents where the rule is still getting triggered. I am hoping you will be able to narrow down (or solve!) the issue or at least help me get my head sorted so I can approach the problem with a different mindset or just fresh eyes.

In summary I am doing the following:
var allRules = await rulesClient.GetRulesAsync(squidexConfiguration.AppName);
foreach(var rule in allRules.Items)
{
await rulesClient.DisableRuleAsync(<>, rule.Id);
}
var chunkedLists = bulkUpdateJobs.Chunk(1000);
foreach (var chunkedList in chunkedLists)
{
var chunkedBulkResult = await articlesSquidexClient.BulkUpdateAsync(new BulkUpdate
{
Jobs = chunkedList.ToList()
});
}
var allRulesAfterMigration = await rulesClient.GetRulesAsync(squidexConfiguration.AppName);
foreach(var rule in allRulesAfterMigration.Items)
{
await rulesClient.EnableRuleAsync(<>, rule.Id);
}

Note: We have two rules, and it seems to be just the second that is getting failures despite it appearing to disable OK with the code I have in place. However that second rule also deals with much less complex data so perhaps that is why it is behaving differently.

Is there any caching of rules that could prevent this from working 100% of the time or perhaps something dodgy about my asynchronous code that comes to mind? Is there any chance of bulk updates being processed by Squidex after the rule has been re-enabled if it is done too quickly?

I did disable the “replicated” setting in the Squidex configuration but I think that was a red herring as it just deals with caching of Rule Ids from a brief look at the source code.

Versions being used: Originally was using Squidex fd2b2eb7e28463ed26847f1ff347f3ef583958e4 (
“Bring back fullscreen mode and add expansed mode. (#843)”) with Squidex.ClientLibrary v7.7.0 but was still hitting this problem with latest Squidex master build and Squidex.ClientLibrary v8.10.0.

Any guidance would be greatly appreciated,
Paul

p.s is there a changelog somewhere for the Squidex.ClientLibrary? Have had a look but couldn’t find one, would be handy to see all the changes (especially breaking) between major versions 7 and 8.

It has nothing to do with the client library. It is the caching of rules. So you have to wait 10 seconds:

1 Like

Good morning and thanks for resolving this for me, I feel like I opened every ‘Rule’ class aside from that one! Colleague has tested by waiting before calling bulk update endpoint and has not had the rule trigger so this was definitely the cause.

1 Like