Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymVlasov committed Feb 9, 2024
1 parent 7932ee1 commit a5d0980
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ If you'd like to set parallelism value relative to number of CPU logical cores -
> If during fine-tuning you'll find that your results are very different from provided below and you think that this data could help someone else - feel free to send PR.
>
>
> | Hook | Most used resource | Optimization runs comparison / Notes |
> | Hook | Most used resource | Comparison of optimization results / Notes |
> | ---------------------------------------- | ---------------------------------- | --------------------------------------------------------------- |
> | terraform_checkov | CPU heavy | - |
> | terraform_fmt | CPU heavy | - |
Expand Down
10 changes: 3 additions & 7 deletions hooks/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,6 @@ function common::per_dir_hook {
parallelism_disabled=true
fi

# preserve errexit status
shopt -qo errexit

local final_exit_code=0
local pids=()

Expand All @@ -281,8 +278,7 @@ function common::per_dir_hook {

per_dir_hook_unique_part "$dir_path" "$change_dir_in_unique_part" "$parallelism_disabled" "${args[@]}"
} &
pid=$!
pids+=("$pid")
pids+=("$!")

if [ $parallelism_disabled ] ||
[ "$i" != 0 ] && [ $((i % parallelism_limit)) == 0 ] || # don't stop on first iteration when parallelism_limit>1
Expand All @@ -298,7 +294,7 @@ function common::per_dir_hook {
fi
done
# Reset pids for next iteration
pids=()
unset pids
fi

done
Expand Down Expand Up @@ -388,7 +384,7 @@ function common::terraform_init {
if mkdir "$PARALLELISM_FALLBACK_LOCK_DIR" 2> /dev/null; then
init_output=$(terraform init -backend=false "${TF_INIT_ARGS[@]}" 2>&1)
exit_code=$?
rmdir "$PARALLELISM_FALLBACK_LOCK_DIR"
rm -rf "$PARALLELISM_FALLBACK_LOCK_DIR"
break
fi
sleep 1
Expand Down

0 comments on commit a5d0980

Please sign in to comment.