DelaySync Component

DelaySync is a collection to which entities found in the TargetEntities collection can be added to.

$delaySync.Push($entity);

Adding an entity to delaySync will cause the synchronization process to not complete for that entity. Instead it is ignored and reattempted during the next synchronization, and a delay count is incremented which can be accessed with the following:

$targetEntity.GetDelayedCount();

This enables a task to prevent the synchronization of entities until some condition is met, e.g.: an external process is complete.

Examples

# Delays sync of all target entities until they have been delayed 5 times.
# Then synchronization will proceed
foreach ($targetEntity in $targetEntities)
{
    if ($targetEntity.GetDelayedCount() -lt 5) 
    {
        $delaySync.Push($targetEntity);
    }
}
# Delays sync until a dependency has been created.
foreach ($targetEntity in $targetEntities)
{
    $dependencyExists = CheckDependencyExists($targetEntity);
    if (-Not $dependencyExists)
    {
        $delaySync.Push($targetEntity);
    }
}

Is this article helpful for you?