From ad4934f57895da62da258da73dfb22f1deebe9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Mon, 10 Mar 2025 17:37:42 +0100 Subject: [PATCH] Do only one automatic download retry Additionally changed the logic so the retry count really means the retry count (it was actually the total amount of attempts). --- service/lib/agama/software/callbacks/media.rb | 2 +- service/lib/agama/software/repository.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/lib/agama/software/callbacks/media.rb b/service/lib/agama/software/callbacks/media.rb index f4203b27d5..6c34e3a00b 100644 --- a/service/lib/agama/software/callbacks/media.rb +++ b/service/lib/agama/software/callbacks/media.rb @@ -89,7 +89,7 @@ def media_change(error_code, error, url, product, current, current_label, wanted # "IO" = IO error (scratched DVD or HW failure) # "IO_SOFT" = network timeout # in other cases automatic retry usually does not make much sense - if ["IO", "IO_SOFT"].include?(error_code) && attempt < Repository::RETRY_COUNT + if ["IO", "IO_SOFT"].include?(error_code) && attempt <= Repository::RETRY_COUNT self.attempt += 1 logger.info("Retry in #{Repository::RETRY_DELAY} seconds, attempt #{attempt}...") sleep(Repository::RETRY_DELAY) diff --git a/service/lib/agama/software/repository.rb b/service/lib/agama/software/repository.rb index b2eb0d56be..9c010ec6e1 100644 --- a/service/lib/agama/software/repository.rb +++ b/service/lib/agama/software/repository.rb @@ -34,7 +34,7 @@ class Repository < Y2Packager::Repository # delay before retrying (in seconds) RETRY_DELAY = 5 # number of automatic retries - RETRY_COUNT = 3 + RETRY_COUNT = 1 # Probes a repository # @@ -47,7 +47,7 @@ def probe # on a timeout error the result is nil, retry automatically in that case, # note: callbacks are disabled during repo probing call type = Yast::Pkg.RepositoryProbe(url.to_s, product_dir) - break if !type.nil? || attempt == RETRY_COUNT + break if !type.nil? || attempt > RETRY_COUNT sleep(RETRY_DELAY) attempt += 1 @@ -65,7 +65,7 @@ def refresh loop do @loaded = !!super - break if @loaded || attempt == RETRY_COUNT + break if @loaded || attempt > RETRY_COUNT sleep(RETRY_DELAY) attempt += 1