Dont' retry if remaining time isn't enough.
This commit is contained in:
Родитель
e9d57c4300
Коммит
30a0551475
|
@ -45,14 +45,16 @@ namespace Microsoft.Azure.EventHubs
|
||||||
double nextRetryInterval = Math.Pow(this.retryFactor, (double)currentRetryCount);
|
double nextRetryInterval = Math.Pow(this.retryFactor, (double)currentRetryCount);
|
||||||
long nextRetryIntervalSeconds = (long)nextRetryInterval;
|
long nextRetryIntervalSeconds = (long)nextRetryInterval;
|
||||||
long nextRetryIntervalMilliseconds = (long)((nextRetryInterval - (double)nextRetryIntervalSeconds) * 1000);
|
long nextRetryIntervalMilliseconds = (long)((nextRetryInterval - (double)nextRetryIntervalSeconds) * 1000);
|
||||||
if (remainingTime.TotalSeconds < Math.Max(nextRetryInterval, ClientConstants.TimerToleranceInSeconds))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
TimeSpan retryAfter = this.minimumBackoff.Add(TimeSpan.FromMilliseconds(nextRetryIntervalSeconds * 1000 + nextRetryIntervalMilliseconds));
|
TimeSpan retryAfter = this.minimumBackoff.Add(TimeSpan.FromMilliseconds(nextRetryIntervalSeconds * 1000 + nextRetryIntervalMilliseconds));
|
||||||
retryAfter = retryAfter.Add(TimeSpan.FromSeconds(baseWaitTimeSecs));
|
retryAfter = retryAfter.Add(TimeSpan.FromSeconds(baseWaitTimeSecs));
|
||||||
|
|
||||||
|
// Don't retry if remaining time isn't enough.
|
||||||
|
if (remainingTime.TotalSeconds < Math.Max(retryAfter.TotalSeconds, ClientConstants.TimerToleranceInSeconds))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return retryAfter;
|
return retryAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче