diff --git a/src/core/Akka.Persistence/Snapshot/SnapshotStore.cs b/src/core/Akka.Persistence/Snapshot/SnapshotStore.cs index fe5d86540ac..a987b683d9a 100644 --- a/src/core/Akka.Persistence/Snapshot/SnapshotStore.cs +++ b/src/core/Akka.Persistence/Snapshot/SnapshotStore.cs @@ -8,6 +8,7 @@ using System; using System.Threading.Tasks; using Akka.Actor; +using Akka.Event; using Akka.Pattern; namespace Akka.Persistence.Snapshot @@ -20,6 +21,7 @@ public abstract class SnapshotStore : ActorBase private readonly TaskContinuationOptions _continuationOptions = TaskContinuationOptions.ExecuteSynchronously; private readonly bool _publish; private readonly CircuitBreaker _breaker; + private readonly ILoggingAdapter _log; /// /// Initializes a new instance of the class. @@ -42,6 +44,8 @@ protected SnapshotStore() config.GetInt("circuit-breaker.max-failures", 10), config.GetTimeSpan("circuit-breaker.call-timeout", TimeSpan.FromSeconds(10)), config.GetTimeSpan("circuit-breaker.reset-timeout", TimeSpan.FromSeconds(30))); + + _log = Context.GetLogger(); } /// @@ -103,7 +107,16 @@ private bool ReceiveSnapshotStore(object message) try { ReceivePluginInternal(message); - _breaker.WithCircuitBreaker(() => DeleteAsync(saveSnapshotFailure.Metadata)); + _breaker.WithCircuitBreaker(() => DeleteAsync(saveSnapshotFailure.Metadata)) + .ContinueWith(t => + { + if(t.IsFaulted) + _log.Error(t.Exception, "DeleteAsync operation after SaveSnapshot failure failed."); + else if(t.IsCanceled) + _log.Error(t.Exception, t.Exception is not null + ? "DeleteAsync operation after SaveSnapshot failure canceled." + : "DeleteAsync operation after SaveSnapshot failure canceled, possibly due to timing out."); + }, TaskContinuationOptions.ExecuteSynchronously); } finally {