From 78dd537c35108665fc6e3872b99a48d71c9eac54 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 20 Jun 2017 13:35:36 +0200 Subject: [PATCH] Allow setting number of workers --- root/etc/e-smith/templates/etc/sysconfig/sogo/Prefork | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/root/etc/e-smith/templates/etc/sysconfig/sogo/Prefork b/root/etc/e-smith/templates/etc/sysconfig/sogo/Prefork index ae2bba5..e07de73 100644 --- a/root/etc/e-smith/templates/etc/sysconfig/sogo/Prefork +++ b/root/etc/e-smith/templates/etc/sysconfig/sogo/Prefork @@ -1,12 +1,18 @@ { use esmith::AccountsDB; -my $a = esmith::AccountsDB->open_ro || die "Couldn't open AccountsDB\n"; -my $users = scalar($a->users()); -my $fork = int($users/8); -$fork = 3 if ($fork < 3); -my $activeSync = $sogod{'ActiveSync'} || 'disabled'; -$fork = $fork*2 if ($activeSync =~ m/^enabled|on|1|yes$/i); +use esmith::ConfigDB; +my $fork; +if ($sogod{Workers}){ + $fork = $sogod{Workers}; +} +else{ + my $users_per_worker = (defined $sogod{UsersPerWorker}) ? $sogod{UsersPerWorker} : (($sogod{'ActiveSync'} || 'disabled') =~ m/^enabled|on|1|yes$/i) ? 4 : 7; + my $a = esmith::AccountsDB->open_ro || die "Couldn't open AccountsDB\n"; + my $users = scalar($a->users()); + $fork = int($users/$users_per_worker); + $fork = 3 if ($fork < 3); +} $OUT .= "PREFORK=$fork";