Files
datafusion/ci/scripts/retry
T
Piotr Findeisen c3681dc865 chore: try make Setup Rust CI step immune to network hang (#13495)
Try add a timeout to the apt-get invocation so that retry can kick in.
2024-11-19 17:46:14 -05:00

22 lines
334 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
x() {
echo "+ $*" >&2
"$@"
}
max_retry_time_seconds=$(( 5 * 60 ))
retry_delay_seconds=10
END=$(( $(date +%s) + ${max_retry_time_seconds} ))
while (( $(date +%s) < $END )); do
x "$@" && exit 0
sleep "${retry_delay_seconds}"
done
echo "$0: retrying [$*] timed out" >&2
exit 1