Skip to content
Merged
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
7 changes: 3 additions & 4 deletions src/core/Akka.Persistence/Snapshot/SnapshotStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ private bool ReceiveSnapshotStore(object message)
}
else if (message is SaveSnapshot saveSnapshot)
{
var metadata = new SnapshotMetadata(saveSnapshot.Metadata.PersistenceId, saveSnapshot.Metadata.SequenceNr, DateTime.UtcNow);
var metadata = new SnapshotMetadata(saveSnapshot.Metadata.PersistenceId, saveSnapshot.Metadata.SequenceNr, saveSnapshot.Metadata.Timestamp == DateTime.MinValue ? DateTime.UtcNow : saveSnapshot.Metadata.Timestamp);
Comment thread
Aaronontheweb marked this conversation as resolved.

_breaker.WithCircuitBreaker(() => SaveAsync(metadata, saveSnapshot.Snapshot))
.ContinueWith(t => (!t.IsFaulted && !t.IsCanceled)
? new SaveSnapshotSuccess(metadata) as ISnapshotResponse
: new SaveSnapshotFailure(saveSnapshot.Metadata,
t.IsFaulted
? TryUnwrapException(t.Exception)
: new OperationCanceledException("SaveAsync canceled, possibly due to timing out.")),
: new OperationCanceledException("SaveAsync canceled, possibly due to timing out.", TryUnwrapException(t.Exception))),
_continuationOptions)
.PipeTo(self, senderPersistentActor);
}
Expand Down Expand Up @@ -196,8 +196,7 @@ private bool ReceiveSnapshotStore(object message)

private Exception TryUnwrapException(Exception e)
{
var aggregateException = e as AggregateException;
if (aggregateException != null)
if (e is AggregateException aggregateException)
Comment thread
Aaronontheweb marked this conversation as resolved.
{
aggregateException = aggregateException.Flatten();
if (aggregateException.InnerExceptions.Count == 1)
Expand Down