Don't retry if remaining time isn't enough.

This commit is contained in:
serkar 2016-12-01 17:18:06 -08:00
Родитель 30a0551475
Коммит e0d33e93d6
2 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -49,12 +49,6 @@ namespace Microsoft.Azure.EventHubs
TimeSpan retryAfter = this.minimumBackoff.Add(TimeSpan.FromMilliseconds(nextRetryIntervalSeconds * 1000 + nextRetryIntervalMilliseconds));
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;
}

Просмотреть файл

@ -95,7 +95,16 @@ namespace Microsoft.Azure.EventHubs
}
}
return this.OnGetNextRetryInterval(clientId, lastException, remainingTime, baseWaitTime);
var retryAfter = this.OnGetNextRetryInterval(clientId, lastException, remainingTime, baseWaitTime);
// Don't retry if remaining time isn't enough.
if (retryAfter == null ||
remainingTime.TotalSeconds < Math.Max(retryAfter.Value.TotalSeconds, ClientConstants.TimerToleranceInSeconds))
{
return null;
}
return retryAfter;
}
}
}