uSync Exclude/Ignore problem

Umb V13.10.0 with uSync v13.2.7 + FormsEdition (v13.4.4.0)

I have a site with an external root node called Courses (docType courseList) which can have multiple subjectPages each of which can have multiple coursePages. I want to stop uSync from processing coursePages as they get imported every night from an external source. So, in conjunction with Claude I finally have this (have tried other solutions) in appsettings.json:-

"uSync": {
  "Sets": {
    "Default": {
      "Handlers": {
        "ContentHandler": {
          "Settings": {
            "RulesOnExport": "True",
            "Exclude": "/Courses/*/*",
            "Rules": [
              {
                "Name": "Exclude all coursePage nodes by docType",
                "DocType": "coursePage",
                "Action": "Ignore"
              }
            ]
          }
        }
      }
    }
  }
}

But each time I do a clean export I get this error from a page that is a coursePage which should be being ignored:-

Error: The path ‘/home/craig/DotNetCoreSites/MyProject - newArch/Web/uSync/v9/Content/city-guilds-nptc-l2-award-in-operating-pedestrian-hand-held-applicators-fitted-with-hydraulic-nozzles-or-rotary-atomisers-to-apply-pesticides-to-or-near-water-pa6aw.config’ is too long, or a component of the specified path is too long.”

What am I (and Claude!) doing wrong or is it not possible to do what I want?

Thanks.

Craig

I’ve had this issue as well. I think the reason is that thee Ignored pages won’t be imported and ignored, but they will still be created and updated. As far as I know you cannot have settings that will just completely ignore a node and not make a file for it.

Claude is to put it politely making this up.

My experience is AI hallucinates config (not just for uSync but for a lot of things) more often then it does other things.

Rules is not a usync config thing. and the exclude/include doesn’t do glob patterns.

There is some docs here. (Exclude/Include Content | Jumoo docs)

but in summary you want:

"uSync": {
    "Sets": {
      "Default": {
        "Handlers": {
          "ContentHandler": {
            "Settings": {
              "Exclude": "/Courses",
              "RulesOnExport": "False" 
           }
          }
        }
     }
   }
 }

check the path in an existing uSync config file to confirm it’s /Courses and not say /home/Courses

Thanks Kevin,

That’s what I had previously (but with “RulesOnExport”:”True”) and that seemed to work. I was just trying to see if I could narrow it down to a docType two levels down from Courses. I guess not.

I set it to True so it didn’t do anything with them at all :slight_smile:

Thanks.

So I told Claude I’d spoken with the creator of uSync and this was it’s grovelling reply, enjoy :wink:

”You’re absolutely right, and I apologize for the confusion. Thank you for checking with the uSync creator directly - that’s the authoritative source.

Combined Exclude + Rules uSync Configuration

Code ∙ Version 2

The correct and only supported approach is:

  • "Exclude": "/Courses" - excludes the entire /Courses node and all its descendants

  • "RulesOnExport": "False" - disables the rules system

This will prevent uSync from processing any content under the /Courses path, which solves your original problem of preventing coursePage processing, though it does exclude the entire branch rather than being more granular.

I apologize for providing incorrect information about the more complex Rules configurations - you were right to verify with the source.”

1 Like

:laughing:

To continue to prove i am a little more useful than AI :wink: .

if the import is creating things of a certain doctype, you can exclude that from the process too. there is a Include/Exclude Doctypes. so only certain doctypes will be included

And what might work (not tested recently it but in theory) you could pause uSync during the import process.

there is a uSyncEventService which has pause and unpause methods that stop uSync from triggering on events (its part of the system usync uses internally to not trip up over itself).

public class uSyncPauseExample
{
    private readonly uSyncEventService _uSyncEventService;

    public uSyncPauseExample(uSyncEventService uSyncEventService)
    {
        _uSyncEventService = uSyncEventService;
    }

    public void DoSomeWork()
    {
        try
        {
            _uSyncEventService.Pause();

            // anything imported or updated here will not be saved by uSync until we unpause.
        }
        finally
        {
            _uSyncEventService.UnPause();
        }
    }
}
1 Like