using System; using Microsoft.AspNetCore.SignalR.Client; using xPushService.Configurations; namespace xPushService.Policies { public class XPushServiceConnectionRetryPolicy : IRetryPolicy { // #region Props ... // Exception retryReason = null; long previousRetryCount = 0; TimeSpan elapsedMilliseconds; // private readonly XPushServiceConfiguration config; #endregion // #region Constructor ... public XPushServiceConnectionRetryPolicy ( XPushServiceConfiguration config ) { this.config = config; } #endregion public TimeSpan? NextRetryDelay (RetryContext retryContext) { // this.retryReason = retryContext.RetryReason; this.previousRetryCount = retryContext.PreviousRetryCount; this.elapsedMilliseconds = retryContext.ElapsedTime; // if (retryContext.PreviousRetryCount < config.PushConnectionMaxRetry) { return TimeSpan.FromMilliseconds (this.config.PushConnectionReconnectDelay); } else { return null; } } } }