]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: If process was used for multiple sessions, some of the fields weren't set...
authorTimo Sirainen <tss@iki.fi>
Thu, 6 Aug 2015 09:17:45 +0000 (12:17 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 6 Aug 2015 09:17:45 +0000 (12:17 +0300)
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.

src/plugins/stats/stats-plugin.c

index c1227f914d228875d3aa5cbdd84e4b75ad3dd43d..f57c5ce3ecef73a9a7d8b1344f4706d0291478e9 100644 (file)
@@ -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 = {