Skip to content

Commit

Permalink
Add max attempts to package manager loop
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettj12 committed Oct 24, 2022
1 parent 2ed4de2 commit 3e9dee7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config/global_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ package config
const (
// PackageManagerLoopFunction is a bash function that executes its arguments
// in a loop with a delay until either the command either returns
// with an exit code other than 100.
// with an exit code other than 100. It times out after 5 failed attempts.
PackageManagerLoopFunction = `
function package_manager_loop {
local attempts=0
local rc=
while true; do
attempts=$((attempts+1))
if ($*); then
return 0
else
rc=$?
fi
if [ $rc -eq 100 ]; then
if [ $attempts -lt 5 -a $rc -eq 100 ]; then
sleep 10s
continue
fi
Expand Down

0 comments on commit 3e9dee7

Please sign in to comment.