Browse Source

Do not update content when stale.

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

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

@ -314,9 +314,18 @@ namespace Squidex.Infrastructure.Commands
await persistence.ReadAsync();
if (persistence.IsSnapshotStale)
{
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