diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-13 18:08:56 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-13 18:08:56 +0000 |
commit | 7b7bc31c5ba07eebe62e2f2582f111ce24285cd4 (patch) | |
tree | 70c795a932a603e49176d30ee5f0835fcfed46c2 /scripts/utils.sh | |
parent | cb38c5062c623059d311c4e9e37428eacdea95d6 (diff) | |
download | gitlab-ce-7b7bc31c5ba07eebe62e2f2582f111ce24285cd4.tar.gz |
Add latest changes from gitlab-org/gitlab@master
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 } |