From 15f37d20a0b07e9ffa4465b0d55b10947ac80fee Mon Sep 17 00:00:00 2001 From: Jackeagle Date: Fri, 14 Jun 2024 04:52:03 -0400 Subject: [PATCH] src/build.sh: Limit parallel jobs in repo sync to a maximum of 10 Signed-off-by: Jackeagle --- src/build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/build.sh b/src/build.sh index c12979a..f7679cc 100755 --- a/src/build.sh +++ b/src/build.sh @@ -20,6 +20,10 @@ # cd to working directory cd "$SRC_DIR" || return 1 +# Determine the number of parallel jobs to use for repo sync +nproc_value=$(nproc --all) +JOBS=$(( nproc_value > 10 ? 10 : nproc_value )) + if [ -f /root/userscripts/begin.sh ]; then echo ">> [$(date)] Running begin.sh" /root/userscripts/begin.sh @@ -186,7 +190,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] Syncing branch repository" builddate=$(date +%Y%m%d) - repo_out=$(repo sync -c -j$(nproc --all) --force-sync 2>&1 >/dev/null) + repo_out=$(repo sync -c -j"$JOBS" --force-sync 2>&1 >/dev/null) repo_status=$? echo -e $repo_out @@ -267,7 +271,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then echo ">> [$(date)] Syncing branch repository" cd "$SRC_DIR/$branch_dir" || return 1 - if ! repo sync -c -j$(nproc --all) --force-sync; then + if ! repo sync -c -j"$JOBS" --force-sync; then sync_successful=false build_device=false fi -- GitLab