changeset 18918:46c34f3a73a0

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.
author Timo Sirainen <tss@iki.fi>
date Thu, 06 Aug 2015 12:17:45 +0300
parents 233802591cfb
children 98158ef015f7
files src/plugins/stats/stats-plugin.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/stats/stats-plugin.c	Tue Aug 04 11:31:17 2015 +0300
+++ b/src/plugins/stats/stats-plugin.c	Thu Aug 06 12:17:45 2015 +0300
@@ -440,6 +440,11 @@
 	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 = {