diff options
author | Jonathan Bauer | 2021-09-17 14:57:57 +0200 |
---|---|---|
committer | Jonathan Bauer | 2021-09-17 14:57:57 +0200 |
commit | 2d3fe1d216a7c7ee0347d6a1675c56b362f9d162 (patch) | |
tree | d2b033014f3a6e8c4758eba4c2c956420286ff22 | |
parent | [dev] Silence some harmless errors/warnings (diff) | |
download | slx-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.
-rw-r--r-- | modules/download.inc | 10 |
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 } |