@@ -152,26 +152,30 @@ main() {
152152 : > packages_already_updated
153153 fi
154154
155- awk -F' |' ' {print $2}' packages_to_update | awk ' !seen[$0]++' > all_owners_tu
156- find " $BKG_INDEX_DIR " -mindepth 1 -maxdepth 1 -type d -exec basename {} \; 2> /dev/null | sort -u > complete_owners
157- echo " new conn"
158- grep -vFxf all_owners_in_db " $connections "
159- echo " missing all"
160- grep -vFxf all_owners_in_db complete_owners
161- echo " stale conn"
162- grep -Fxf all_owners_tu " $connections "
163- echo " stale all"
164- grep -vFxf " $connections " all_owners_tu
155+ awk -F' |' ' {print $2}' packages_to_update | awk ' !seen[$0]++' > all_owners_tu.tmp
156+ find " $BKG_INDEX_DIR " -mindepth 1 -maxdepth 1 -type d -exec basename {} \; 2> /dev/null | sort -u > complete_owners.tmp
157+ grep -vFxf " $connections " all_owners_tu.tmp > all_owners_tu
158+ grep -vFxf " $connections " complete_owners.tmp > complete_owners
165159
166- { # self > stars > some submitted > stale
160+ { # self > new stars > missing > stale stars > rest shuffled
167161 ! grep -qP " \b$GITHUB_OWNER \b" all_owners_tu || echo " 0/$GITHUB_OWNER "
168162 grep -vFxf all_owners_in_db " $connections "
163+ grep -vFxf all_owners_in_db complete_owners
169164 grep -Fxf all_owners_tu " $connections "
170- head -n 1000 " $BKG_OWNERS "
171- bash get.sh " $BKG_INDEX_DIR " " $BKG_INDEX " " $BKG_BATCH_FIRST_STARTED " 2> /dev/null
165+ awk ' BEGIN { srand() }
166+ NR==FNR { base[++n] = $0; next }
167+ { slot = int(rand() * (n + 1))
168+ ins[slot] = (ins[slot] ? ins[slot] ORS $0 : $0)
169+ }
170+ END {
171+ for (i = 0; i <= n; i++) {
172+ if (ins[i] != "") print ins[i]
173+ if (i < n) print base[i + 1]
174+ }
175+ }' all_owners_tu <( head -n 1000 " $BKG_OWNERS " )
172176 } | env_parallel --lb save_owner
173177
174- rm -f all_owners_in_db all_owners_tu
178+ rm -f all_owners_in_db all_owners_tu complete_owners
175179 set_BKG BKG_DIFF " $db_size_curr "
176180 fi
177181 else
0 commit comments