From 4001af8920389e2bb2672b673b181c4e92515872 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 28 Jul 2021 12:43:56 +0200 Subject: 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. --- apt-pkg/acquire-worker.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg') 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 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 -- cgit v1.2.3-70-g09d2