summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJonathan Bauer2021-09-17 14:57:57 +0200
committerJonathan Bauer2021-09-17 14:57:57 +0200
commit2d3fe1d216a7c7ee0347d6a1675c56b362f9d162 (patch)
treed2b033014f3a6e8c4758eba4c2c956420286ff22 /modules
parent[dev] Silence some harmless errors/warnings (diff)
downloadslx-tools-2d3fe1d216a7c7ee0347d6a1675c56b362f9d162.tar.gz
slx-tools-2d3fe1d216a7c7ee0347d6a1675c56b362f9d162.tar.xz
slx-tools-2d3fe1d216a7c7ee0347d6a1675c56b362f9d162.zip
[download] manual retry loop instead of --retry
on some specific errors, curl just ignores --retry and just instantly fail. The new curl option '--retry-all-errors' is only supported starting with version 7.71.0 which is not yet in Ubuntu 20.04. We should probably change to that new option when the base system supports it.
Diffstat (limited to 'modules')
-rw-r--r--modules/download.inc10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/download.inc b/modules/download.inc
index 5191922..1b5d67c 100644
--- a/modules/download.inc
+++ b/modules/download.inc
@@ -5,6 +5,14 @@ download() {
}
download_retry() {
- download --retry 3 --retry-max-time 12 "$@"
+ for delay in {1..3} ""; do
+ if download --retry-max-time 12 "$@"; then
+ return 0
+ fi
+ if [ -n "$delay" ]; then
+ sleep "$delay"
+ fi
+ done
+ return 1
}