remove commented stuff

This commit is contained in:
Heavybullets8 2022-08-11 16:37:19 -06:00
parent ec422e8db9
commit ea7a3e9490

View File

@ -9,54 +9,6 @@ echo "Asynchronous Updates: $update_limit"
[[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout"
[[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips"
# previous 20% 2 min 9 seconds
# it=0
# while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null)
# echo "$while_status" > temp.txt
# rm trigger &>/dev/null
# delay=2
# final_check=0
# while true
# do
# if [[ -f trigger ]]; then
# delay=4
# if while_status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' 2>/dev/null) ; then
# echo "$while_status" > temp.txt
# else
# echo "Middlewared timed out. Consider setting a lower number for async applications"
# continue
# fi
# fi
# proc_count=${#processes[@]}
# count=0
# for proc in "${processes[@]}"
# do
# kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
# ((count++))
# done
# if [[ "$proc_count" -ge "$update_limit" ]]; then
# sleep $delay
# elif [[ $it -lt ${#array[@]} ]]; then
# until [[ "$proc_count" -ge "$update_limit" || $it -ge ${#array[@]} ]]
# do
# update_apps "${array[$it]}" &
# processes+=($!)
# sleep 4
# ((it++))
# ((proc_count++))
# done
# elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
# sleep $delay
# else # All processes must be completed, break out of loop
# [[ $final_check == 0 ]] && ((final_check++)) && continue
# break
# fi
# done
# rm temp.txt
# [[ -f trigger ]] && rm trigger
# echo
# echo
it=0
while_count=0
while true
@ -83,8 +35,8 @@ do
# do
update_apps "${array[$it]}" &
processes+=($!)
((loop++))
((it++))
# ((loop++))
# done
elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
sleep 3
@ -182,12 +134,13 @@ export -f update_apps
update(){
count=0
while [[ $count -lt 3 ]]
while true
do
update_avail=$(grep "^$app_name," temp.txt | awk -F ',' '{print $3}')
if [[ $update_avail == "true" ]]; then
if [[ $count -gt 2 ]]; then
return 1
elif [[ $update_avail == "true" ]]; then
if ! cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null ; then
# [[ ! -e trigger ]] && touch trigger && sleep 10
sleep 6
((count++))
continue
@ -195,9 +148,6 @@ do
break
elif [[ $update_avail == "false" ]]; then
break
else
((count++))
sleep 6
fi
done
}
@ -207,15 +157,14 @@ after_update_actions(){
SECONDS=0
count=0
if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
# [[ ! -e trigger ]] && touch trigger && sleep 10
while true
do
if [[ $count -lt 1 ]]; then
if [[ $count -lt 1 ]]; then
old_status=$(grep "^$app_name," temp.txt)
else
before_loop=$(head -n 1 temp.txt)
new_status=$old_status
until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a change in the file BEFORE continuing
until [[ "$new_status" != "$old_status" || $current_loop -gt 3 ]] # Wait for a specific change to app status, or 3 refreshes of the file to go by.
do
new_status=$(grep "^$app_name," temp.txt)
sleep 1
@ -226,17 +175,6 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
done
old_status=$new_status
fi
# if [[ $count -lt 1 ]]; then
# while_count=$(head -n 1 temp.txt)
# else
# until [[ $while_count -lt $current_count ]] # Wait for a change in the file BEFORE continuing
# do
# current_count=$(head -n 1 temp.txt)
# sleep 1
# done
# while_count=$current_count
# fi
status=$( grep "^$app_name," temp.txt | awk -F ',' '{print $2}')
(( count++ ))
if [[ "$status" == "ACTIVE" ]]; then