File tree Expand file tree Collapse file tree 1 file changed +0
-48
lines changed
Expand file tree Collapse file tree 1 file changed +0
-48
lines changed Original file line number Diff line number Diff line change @@ -146,51 +146,3 @@ copy_reference_file() {
146146 fi
147147 fi
148148}
149-
150- # Retries a command a configurable number of times with backoff.
151- #
152- # The retry count is given by ATTEMPTS (default 60), the initial backoff
153- # timeout is given by TIMEOUT in seconds (default 1.)
154- #
155- function retry_command() {
156- local max_attempts=${ATTEMPTS-3}
157- local timeout=${TIMEOUT-1}
158- local success_timeout=${SUCCESS_TIMEOUT-1}
159- local max_success_attempt=${SUCCESS_ATTEMPTS-1}
160- local attempt=0
161- local success_attempt=0
162- local exitCode=0
163-
164- while (( attempt < max_attempts ))
165- do
166- set +e
167- " $@ "
168- exitCode=$?
169- set -e
170-
171- if [[ $exitCode == 0 ]]
172- then
173- success_attempt=$(( success_attempt + 1 ))
174- if (( success_attempt >= max_success_attempt))
175- then
176- break
177- else
178- sleep " $success_timeout "
179- continue
180- fi
181- fi
182-
183- echo " $( date -u ' +%T' ) Failure ($exitCode ) Retrying in $timeout seconds..." 1>&2
184- sleep " $timeout "
185- success_attempt=0
186- attempt=$(( attempt + 1 ))
187- timeout=$(( timeout ))
188- done
189-
190- if [[ $exitCode != 0 ]]
191- then
192- echo " $( date -u ' +%T' ) Failed in the last attempt ($* )" 1>&2
193- fi
194-
195- return $exitCode
196- }
You can’t perform that action at this time.
0 commit comments