/// <summary> /// Creates poll settings from the given expiration, delay, delay multiplier and maximum delay. /// </summary> /// <param name="expiration">The expiration to use in order to know when to stop polling. Must not be null.</param> /// <param name="delay">The delay between RPC calls. Must be non-negative.</param> /// <param name="delayMultiplier">The multiplier to apply to the delay on each iteration; must be greater or equal to 1.0.</param> /// <param name="maxDelay">The maximum delay to use.</param> public PollSettings(Expiration expiration, TimeSpan delay, double delayMultiplier, TimeSpan maxDelay) { Expiration = GaxPreconditions.CheckNotNull(expiration, nameof(expiration)); Delay = GaxPreconditions.CheckNonNegativeDelay(delay, nameof(delay)); if (delayMultiplier < 1.0 || double.IsNaN(delayMultiplier)) { throw new ArgumentOutOfRangeException(nameof(delayMultiplier), delayMultiplier, "Delay multiplier must be a real number greater than or equal to 1"); } DelayMultiplier = delayMultiplier; MaxDelay = GaxPreconditions.CheckNonNegativeDelay(maxDelay, nameof(maxDelay)); }
/// <summary> /// Creates poll settings from the given expiration, delay and call settings. /// </summary> /// <param name="expiration">The expiration to use in order to know when to stop polling. Must not be null.</param> /// <param name="delay">The delay between RPC calls. Must be non-negative.</param> public PollSettings(Expiration expiration, TimeSpan delay) { Expiration = GaxPreconditions.CheckNotNull(expiration, nameof(expiration)); Delay = GaxPreconditions.CheckNonNegativeDelay(delay, nameof(delay)); }