Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved more deletes to end of process #658

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,18 @@ public virtual IEnumerable<uSyncAction> ProcessPostImport(IEnumerable<uSyncActio
if (actions == null || !actions.Any())
return Enumerable.Empty<uSyncAction>();

return CleanFolders(-1);
var results = new List<uSyncAction>();

// we only do deletes here.
foreach (var action in actions.Where(x => x.Change == ChangeType.Hidden))
{
results.AddRange(
Import(action.FileName, config, SerializerFlags.LastPass));
}

results.AddRange(CleanFolders(-1));

return results;
}

/// <summary>
Expand Down
13 changes: 13 additions & 0 deletions uSync.Core/Serialization/SyncContainerSerializerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Umbraco.Cms.Core.Models.Entities;
using Umbraco.Cms.Core.Services;
using Umbraco.Extensions;
using uSync.Core.Models;

namespace uSync.Core.Serialization
{
Expand All @@ -26,6 +27,18 @@ public SyncContainerSerializerBase(IEntityService entityService, ILogger<SyncCon
this.containerType = containerType;
}

protected override SyncAttempt<TObject> ProcessDelete(Guid key, string alias, SerializerFlags flags)
{
if (flags.HasFlag(SerializerFlags.LastPass))
{
logger.LogDebug("Processing deletes as part of the last pass");
return base.ProcessDelete(key, alias, flags);
}

logger.LogDebug("Delete not processing as this is not the final pass");
return SyncAttempt<TObject>.Succeed(alias, ChangeType.Hidden);
}

protected override Attempt<TObject> FindOrCreate(XElement node)
{

Expand Down