From aa68d5ba820ad232b39153cbbe72ecf6b788b160 Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 17 Mar 2023 21:00:06 +0100 Subject: [PATCH] Limit concurrency to 4 plugins per batch This should help avoid concurrency related issues, sacrificing a little bit of performance --- rootfs/etc/cont-init.d/20-install-plugins | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rootfs/etc/cont-init.d/20-install-plugins b/rootfs/etc/cont-init.d/20-install-plugins index 75ba0c5..1d76039 100755 --- a/rootfs/etc/cont-init.d/20-install-plugins +++ b/rootfs/etc/cont-init.d/20-install-plugins @@ -59,9 +59,16 @@ 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..." + wait + done done - echo "> Waiting for all plugins to install..." + + echo "> Waiting for all tasks to finish..." wait # Plugins are installed concurrently, so we need to verify if installed, separately