mirror of
https://github.com/Kas-tle/java2bedrock.sh.git
synced 2025-12-20 15:19:16 +00:00
Limit concurent jobs to prevent lockup
This commit is contained in:
@@ -50,6 +50,10 @@ user_input () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wait_for_jobs () {
|
||||||
|
while test $(jobs -p | wc -w) -ge "$((2*$(nproc)))"; do wait -n; done
|
||||||
|
}
|
||||||
|
|
||||||
# ensure input pack exists
|
# ensure input pack exists
|
||||||
if ! test -f "${1}"; then
|
if ! test -f "${1}"; then
|
||||||
status_message error "Input resource pack ${1} is not in this directory"
|
status_message error "Input resource pack ${1} is not in this directory"
|
||||||
@@ -890,6 +894,7 @@ do
|
|||||||
status_message completion "${gid} converted\n$(ProgressBar ${tot_pos} ${_end})"
|
status_message completion "${gid} converted\n$(ProgressBar ${tot_pos} ${_end})"
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
wait_for_jobs
|
||||||
convert_model ${file} ${gid} ${generated} &
|
convert_model ${file} ${gid} ${generated} &
|
||||||
|
|
||||||
done < all.csv
|
done < all.csv
|
||||||
|
|||||||
Reference in New Issue
Block a user