[core] Introduce Resource::minimumUpdateInterval

Introduce `Resource::minimumUpdateInterval` and consider it in the online file source.

The `minimumUpdateInterval` is used to throttle the requests, which were initiated due to resource expiration.
This commit is contained in:
Mikhail Pozdnyakov
2020-04-17 14:27:46 +03:00
parent ee1d700a9b
commit 64cbc9911d
3 changed files with 35 additions and 29 deletions

View File

@@ -32,11 +32,11 @@ Duration errorRetryTimeout(Response::Error::Reason failedRequestReason, uint32_t
Duration expirationTimeout(optional<Timestamp> expires, uint32_t expiredRequests) {
if (expiredRequests) {
return Seconds(1u << std::min(expiredRequests - 1, 31u));
} else if (expires) {
return std::max(Seconds::zero(), *expires - util::now());
} else {
return Duration::max();
}
if (expires) {
return std::max(Seconds::zero(), *expires - util::now());
}
return Duration::max();
}
} // namespace http