if gt than 1 sleep

This commit is contained in:
Heavybullets8 2022-08-04 19:10:02 -06:00
parent cad29364a5
commit 17914fada8

View File

@ -25,14 +25,16 @@ do
if [[ "$proc_count" -ge "$update_limit" ]]; then if [[ "$proc_count" -ge "$update_limit" ]]; then
sleep 3 sleep 3
elif [[ $it -lt ${#array[@]} ]]; then elif [[ $it -lt ${#array[@]} ]]; then
new_updates=0
until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]] until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]]
do do
update_apps "${array[$it]}" & update_apps "${array[$it]}" &
processes+=($!) processes+=($!)
((proc_count++)) ((proc_count++))
((it++)) ((it++))
((new_updates++))
done done
sleep 3 [[ $new_updates -gt 1 ]] && sleep 3
elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
sleep 3 sleep 3
else # All processes must be completed, break out of loop else # All processes must be completed, break out of loop