From c26a0afd1ffadf7ea82deeea0c61ccff11983e75 Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 17 Mar 2023 21:14:26 +0100 Subject: [PATCH] Define concurrency limit with variable --- rootfs/etc/cont-init.d/20-install-plugins | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rootfs/etc/cont-init.d/20-install-plugins b/rootfs/etc/cont-init.d/20-install-plugins index 1d76039..735e84c 100755 --- a/rootfs/etc/cont-init.d/20-install-plugins +++ b/rootfs/etc/cont-init.d/20-install-plugins @@ -33,6 +33,7 @@ function main() { PLUGIN_LIST="${WORDPRESS_PLUGIN_LIST:-}" PLUGIN_STRICT_INSTALL="${WORDPRESS_PLUGIN_INSTALL_STRICT:-false}" WP_CONTENT_PATH="/var/www/html/wp-content" + CONCURRENCY_LIMIT="${CONCURRENCY_LIMIT:-4}" echo "> Automated WordPress Plugin Installer" if [ -z "${PLUGIN_LIST}" ]; then @@ -60,9 +61,9 @@ function main() { echo "> Installing plugin '${PLUGIN[0]}' version '${PLUGIN[1]}'" installPlugin "${WP_PLUGIN_INSTALL_ARGS}" & - # Run maximum of 2 plugin installs in parallel - while [ "$(jobs | wc -l)" -ge 2 ]; do - echo " Waiting for batch of 2 plugins to install..." + # Run maximum of X plugin installs in parallel + while [ "$(jobs | wc -l)" -ge "${CONCURRENCY_LIMIT}" ]; do + echo " Waiting for batch of ${CONCURRENCY_LIMIT} plugins to install..." wait done done