File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,11 +20,24 @@ source lib/owner.sh
2020run_owner_updates () {
2121 local owners_queue
2222 local status=0
23+ local updates_pid=" "
2324 owners_queue=$( get_BKG_set BKG_OWNERS_QUEUE)
2425 [ -n " $owners_queue " ] || return 0
2526
2627 if [[ " $GITHUB_OWNER " = " ipitio" && " $( git branch --show-current) " = " master" ]]; then
27- printf ' %s\n' " $owners_queue " | parallel_shell_func " $BKG_ROOT /src/lib/owner.sh" update_owner --lb --halt soon,fail=1
28+ (
29+ printf ' %s\n' " $owners_queue " | parallel_shell_func " $BKG_ROOT /src/lib/owner.sh" update_owner --lb --halt soon,fail=1
30+ ) &
31+ updates_pid=$!
32+
33+ while kill -0 " $updates_pid " 2> /dev/null; do
34+ sleep 30
35+ kill -0 " $updates_pid " 2> /dev/null || break
36+ [ " $( get_BKG BKG_TIMEOUT) " = " 1" ] || continue
37+ echo " Waiting for active owner updates to stop..."
38+ done
39+
40+ wait " $updates_pid "
2841 status=$?
2942 else # typically fewer owners
3043 run_parallel update_owner " $owners_queue "
Original file line number Diff line number Diff line change @@ -127,14 +127,17 @@ update_owner() {
127127 fi
128128
129129 local owner_repos
130+ check_limit || return $?
130131 owner_repos=$( find " $BKG_INDEX_DIR /$owner " -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -I {} basename {})
131132
132133 if [ -n " $owner_repos " ]; then
134+ check_limit || return $?
133135 echo " Creating $owner array..."
134136 find " $BKG_INDEX_DIR /$owner " -type f -name ' *.json' ! -name ' .*' -print0 | xargs -0 jq -cs ' .' > " $BKG_INDEX_DIR /$owner /.json.tmp"
135137 mv -f " $BKG_INDEX_DIR /$owner /.json.tmp" " $BKG_INDEX_DIR /$owner /.json"
136138 bash lib/ytoxt.sh " $BKG_INDEX_DIR /$owner /.json"
137139
140+ check_limit || return $?
138141 echo " Creating $owner repo arrays..."
139142 parallel " jq -c --arg repo {} '[.[] | select(.repo == \$ repo)]' \" $BKG_INDEX_DIR /$owner /.json\" > \" $BKG_INDEX_DIR /$owner /{}/.json.tmp\" " <<< " $owner_repos"
140143 xargs -I {} mv -f " $BKG_INDEX_DIR /$owner /{}/.json.tmp" " $BKG_INDEX_DIR /$owner /{}/.json" 2> /dev/null <<< " $owner_repos"
You can’t perform that action at this time.
0 commit comments