Browse Source

Do not update content when stale.

pull/680/head
Sebastian Stehle 5 years ago
parent
commit
cac9d9df26
  1. 11
      backend/src/Squidex.Infrastructure/Commands/DomainObject.cs
  2. 2
      backend/src/Squidex.Infrastructure/States/Persistence.cs

11
backend/src/Squidex.Infrastructure/Commands/DomainObject.cs

@ -315,7 +315,16 @@ namespace Squidex.Infrastructure.Commands
if (persistence.IsSnapshotStale)
{
await persistence.WriteSnapshotAsync(Snapshot);
try
{
await persistence.WriteSnapshotAsync(Snapshot);
}
catch (Exception ex)
{
log.LogError(ex, w => w
.WriteProperty("action", "RepairSnapshot")
.WriteProperty("status", "Failed"));
}
}
}
}

2
backend/src/Squidex.Infrastructure/States/Persistence.cs

@ -46,7 +46,7 @@ namespace Squidex.Infrastructure.States
public bool IsSnapshotStale
{
get => persistenceMode == PersistenceMode.SnapshotsAndEventSourcing && versionSnapshot < versionEvents;
get => persistenceMode == PersistenceMode.SnapshotsAndEventSourcing && versionSnapshot < versionEvents && versionSnapshot > EtagVersion.Empty;
}
public Persistence(DomainId ownerKey, Type ownerType,

Loading…
Cancel
Save