mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
less0 -> at_least_one
This commit is contained in:
parent
b7a5847c30
commit
a4d28efa6c
1 changed files with 5 additions and 5 deletions
|
@ -311,7 +311,7 @@ ynh_get_scalable_phpfpm () {
|
||||||
# Get the total of RAM available, except swap.
|
# Get the total of RAM available, except swap.
|
||||||
local max_ram=$(ynh_check_ram --no_swap)
|
local max_ram=$(ynh_check_ram --no_swap)
|
||||||
|
|
||||||
less0() {
|
at_least_one() {
|
||||||
# Do not allow value below 1
|
# Do not allow value below 1
|
||||||
if [ $1 -le 0 ]
|
if [ $1 -le 0 ]
|
||||||
then
|
then
|
||||||
|
@ -331,7 +331,7 @@ ynh_get_scalable_phpfpm () {
|
||||||
then
|
then
|
||||||
php_max_children=$(( $php_max_children / 2 ))
|
php_max_children=$(( $php_max_children / 2 ))
|
||||||
fi
|
fi
|
||||||
php_max_children=$(less0 $php_max_children)
|
php_max_children=$(at_least_one $php_max_children)
|
||||||
|
|
||||||
# To not overload the proc, limit the number of children to 4 times the number of cores.
|
# To not overload the proc, limit the number of children to 4 times the number of cores.
|
||||||
local core_number=$(nproc)
|
local core_number=$(nproc)
|
||||||
|
@ -345,13 +345,13 @@ ynh_get_scalable_phpfpm () {
|
||||||
then
|
then
|
||||||
# Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager
|
# Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager
|
||||||
php_min_spare_servers=$(( $php_max_children / 8 ))
|
php_min_spare_servers=$(( $php_max_children / 8 ))
|
||||||
php_min_spare_servers=$(less0 $php_min_spare_servers)
|
php_min_spare_servers=$(at_least_one $php_min_spare_servers)
|
||||||
|
|
||||||
php_max_spare_servers=$(( $php_max_children / 2 ))
|
php_max_spare_servers=$(( $php_max_children / 2 ))
|
||||||
php_max_spare_servers=$(less0 $php_max_spare_servers)
|
php_max_spare_servers=$(at_least_one $php_max_spare_servers)
|
||||||
|
|
||||||
php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 ))
|
php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 ))
|
||||||
php_start_servers=$(less0 $php_start_servers)
|
php_start_servers=$(at_least_one $php_start_servers)
|
||||||
else
|
else
|
||||||
php_min_spare_servers=0
|
php_min_spare_servers=0
|
||||||
php_max_spare_servers=0
|
php_max_spare_servers=0
|
||||||
|
|
Loading…
Add table
Reference in a new issue