summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2021-07-28 12:43:56 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2021-07-28 13:08:35 +0200
commit4001af8920389e2bb2672b673b181c4e92515872 (patch)
tree67c71f916fa5f248761ae2799a941fe67e5ce5c4 /apt-pkg
parent51ee79e385d8ccb2f32195cc01f3f9c943197603 (diff)
Add support for a maximum delay and testing of delay
This is very basic support on the testing side, we just test the debug output but not how long it actually took. Would be nice to check time really.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-worker.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 7be51d114..1bf07e82a 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -644,7 +644,10 @@ void pkgAcquire::Worker::HandleFailure(std::vector<pkgAcquire::Item *> const &It
if (_config->FindB("Acquire::Retries::Delay", true))
{
auto Iter = _config->FindI("Acquire::Retries", 3) - Owner->Retries - 1;
- auto Dur = std::chrono::seconds(1 << Iter);
+ auto const MaxDur = _config->FindI("Acquire::Retries::Delay::Maximum", 30);
+ auto Dur = std::chrono::seconds(std::min(1 << Iter, MaxDur));
+ if (_config->FindB("Debug::Acquire::Retries"))
+ std::clog << "Delaying " << SavedDesc.Description << " by " << Dur.count() << " seconds" << std::endl;
Owner->FetchAfter(currentTime + Dur);
}
else