changeset 19395:dc08ba342085

stats: Forced sending of UPDATE-SESSION every 5 minutes wasn't working. This caused stats process to forget about idling (imap) sessions if they didn't do anything for over 15 minutes.
author Timo Sirainen <tss@iki.fi>
date Wed, 18 Nov 2015 19:15:36 +0200
parents 109c23a7412a
children 626758356cce
files src/plugins/stats/stats-plugin.c
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/stats/stats-plugin.c	Wed Nov 18 18:54:51 2015 +0200
+++ b/src/plugins/stats/stats-plugin.c	Wed Nov 18 19:15:36 2015 +0200
@@ -103,22 +103,19 @@
 	}
 	*changed_r = FALSE;
 
+	diff = now - suser->last_session_update;
+	if (diff >= SESSION_STATS_FORCE_REFRESH_SECS)
+		return TRUE;
+	*to_next_secs_r = SESSION_STATS_FORCE_REFRESH_SECS - diff;
+
 	if (!suser->session_sent_duplicate) {
 		if (suser->last_session_update != now) {
 			/* send one duplicate notification so stats reader
 			   knows that this session is idle now */
 			return TRUE;
 		}
-		*to_next_secs_r = 1;
-		return FALSE;
 	}
-
-	diff = now - suser->last_session_update;
-	if (diff < SESSION_STATS_FORCE_REFRESH_SECS) {
-		*to_next_secs_r = SESSION_STATS_FORCE_REFRESH_SECS - diff;
-		return FALSE;
-	}
-	return TRUE;
+	return FALSE;
 }
 
 static void session_stats_refresh(struct mail_user *user)