diff options
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r-- | scripts/utils.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh index 55005d0abff..df8a5825dab 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -1,10 +1,19 @@ function retry() { + retry_times_sleep 2 3 "$@" +} + +function retry_times_sleep() { + number_of_retries="$1" + shift + sleep_seconds="$1" + shift + if eval "$@"; then return 0 fi - for i in 2 1; do - sleep 3s + for i in $(seq "${number_of_retries}" -1 1); do + sleep "$sleep_seconds"s echo "[$(date '+%H:%M:%S')] Retrying $i..." if eval "$@"; then return 0 @@ -32,6 +41,7 @@ function retry_exponential() { return 0 fi done + return 1 } |