Example #1
0
 /// <summary>
 /// use partial exponential backoff to determine wait time.
 /// </summary>
 /// <param name="previousAttempts"></param>
 /// <param name="totalElapsedTime"></param>
 /// <param name="error"></param>
 /// <returns></returns>
 public long CalcBackoff(int previousAttempts, long totalElapsedTime, Api.Models.Error error)
 {
     if (totalElapsedTime > maxRetryTime)
     {
         logger.Info("Total elapsed timeout exceeded, exiting retry loop");
         return(-1);
     }
     return((long)((Math.Pow(2, previousAttempts) * 1000) + new Random().Next(0, 1000)));
 }
Example #2
0
        /// <summary>
        /// The default CalcBackoff implementation. Uses exponential backoff. If the maximum elapsed time
        /// has expired, this calculation returns -1 causing the caller to fall out of the retry loop.
        /// </summary>
        /// <param name="previousAttempts"></param>
        /// <param name="totalElapsedTime"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public virtual long CalcBackoff(int previousAttempts, long totalElapsedTime, Api.Models.Error error)
        {
            long backoffMillis = (long)((Math.Pow(2, previousAttempts) * 1000) + new Random().Next(0, 1000));

            if (totalElapsedTime + backoffMillis > this.maxRetryTimeout)
            {
                logger.Info("Total elapsed timeout exceeded, exiting retry loop");
                return(-1);
            }
            return(backoffMillis);
        }
 /// <summary>
 /// Instantiates a new access token expired exception.
 /// </summary>
 /// <param name="error"> the error </param>
 public AccessTokenExpiredException(Error error) : base(error)
 {
 }
 /// <summary>
 /// <para>Constructor.</para>
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public SmartsheetRestException(Error error) : base(error.Message)
 {
     errorCode = error.ErrorCode;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public InvalidRequestException(Error error) : base(error)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public ResourceNotFoundException(Error error)
     : base(error)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public AuthorizationException(Error error)
     : base(error)
 {
 }
Example #8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public AuthorizationException(Error error) : base(error)
 {
 }
Example #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public ResourceNotFoundException(Error error) : base(error)
 {
 }
 /// <summary>
 /// <para>Constructor.</para>
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public SmartsheetRestException(Error error)
     : base(error.Message)
 {
     errorCode = error.ErrorCode;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public InvalidRequestException(Error error)
     : base(error)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public ServiceUnavailableException(Error error)
     : base(error)
 {
 }
 /// <summary>
 /// Instantiates a new access token expired exception.
 /// </summary>
 /// <param name="error"> the error </param>
 public AccessTokenExpiredException(Error error)
     : base(error)
 {
 }
Example #14
0
 /// <summary>
 /// <para>Constructor.</para>
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public SmartsheetRestException(Error error) : base(error.Message)
 {
     errorCode = error.ErrorCode;
     refId     = error.RefId;
     detail    = error.Detail;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="error"> the Error object from Smartsheet REST API </param>
 public ServiceUnavailableException(Error error) : base(error)
 {
 }