From: Timo Sirainen Date: Thu, 6 Aug 2015 09:17:45 +0000 (+0300) Subject: stats: If process was used for multiple sessions, some of the fields weren't set... X-Git-Tag: 2.2.19.rc1~276 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38db7268f7331d0c857a6b748f8af71cd6683028;p=thirdparty%2Fdovecot%2Fcore.git stats: If process was used for multiple sessions, some of the fields weren't set correctly. For example the second user's disk_output was increased at startup by the same amount as what the previous user's last disk_output value was. --- diff --git a/src/plugins/stats/stats-plugin.c b/src/plugins/stats/stats-plugin.c index c1227f914d..f57c5ce3ec 100644 --- a/src/plugins/stats/stats-plugin.c +++ b/src/plugins/stats/stats-plugin.c @@ -440,6 +440,11 @@ static void stats_user_created(struct mail_user *user) suser->to_stats_timeout = timeout_add(suser->refresh_secs*1000, session_stats_refresh_timeout, user); + /* fill the initial values. this is necessary for the process-global + values (e.g. getrusage()) if the process is reused for multiple + users. otherwise the next user will start with the previous one's + last values. */ + mail_user_stats_fill(user, suser->pre_io_stats); } static struct mail_storage_hooks stats_mail_storage_hooks = {