88using System ;
99using System . Threading . Tasks ;
1010using Akka . Actor ;
11+ using Akka . Event ;
1112using Akka . Pattern ;
1213
1314namespace Akka . Persistence . Snapshot
@@ -20,6 +21,7 @@ public abstract class SnapshotStore : ActorBase
2021 private readonly TaskContinuationOptions _continuationOptions = TaskContinuationOptions . ExecuteSynchronously ;
2122 private readonly bool _publish ;
2223 private readonly CircuitBreaker _breaker ;
24+ private readonly ILoggingAdapter _log ;
2325
2426 /// <summary>
2527 /// Initializes a new instance of the <see cref="SnapshotStore"/> class.
@@ -42,6 +44,8 @@ protected SnapshotStore()
4244 config . GetInt ( "circuit-breaker.max-failures" , 10 ) ,
4345 config . GetTimeSpan ( "circuit-breaker.call-timeout" , TimeSpan . FromSeconds ( 10 ) ) ,
4446 config . GetTimeSpan ( "circuit-breaker.reset-timeout" , TimeSpan . FromSeconds ( 30 ) ) ) ;
47+
48+ _log = Context . GetLogger ( ) ;
4549 }
4650
4751 /// <inheritdoc/>
@@ -103,7 +107,16 @@ private bool ReceiveSnapshotStore(object message)
103107 try
104108 {
105109 ReceivePluginInternal ( message ) ;
106- _breaker . WithCircuitBreaker ( ( ) => DeleteAsync ( saveSnapshotFailure . Metadata ) ) ;
110+ _breaker . WithCircuitBreaker ( ( ) => DeleteAsync ( saveSnapshotFailure . Metadata ) )
111+ . ContinueWith ( t =>
112+ {
113+ if ( t . IsFaulted )
114+ _log . Error ( t . Exception , "DeleteAsync operation after SaveSnapshot failure failed." ) ;
115+ else if ( t . IsCanceled )
116+ _log . Error ( t . Exception , t . Exception is not null
117+ ? "DeleteAsync operation after SaveSnapshot failure canceled."
118+ : "DeleteAsync operation after SaveSnapshot failure canceled, possibly due to timing out." ) ;
119+ } , TaskContinuationOptions . ExecuteSynchronously ) ;
107120 }
108121 finally
109122 {
0 commit comments