changeset 20966:9a41bc549b03

director: Show in process title how many users are being moved.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 24 Oct 2016 20:07:26 +0300
parents eff5fc952993
children 1be6845a989b
files src/director/director.c src/director/director.h src/director/main.c
diffstat 3 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/director.c	Mon Oct 24 20:00:40 2016 +0300
+++ b/src/director/director.c	Mon Oct 24 20:07:26 2016 +0300
@@ -808,6 +808,9 @@
 	user->kill_state = USER_KILL_STATE_NONE;
 	timeout_remove(&user->to_move);
 
+	i_assert(dir->users_moving_count > 0);
+	dir->users_moving_count--;
+
 	dir->state_change_callback(dir);
 }
 
@@ -978,6 +981,7 @@
 		ctx->username_hash = username_hash;
 		ctx->self = src->self;
 
+		dir->users_moving_count++;
 		user->to_move = timeout_add(DIRECTOR_USER_MOVE_TIMEOUT_MSECS,
 					    director_user_move_timeout, user);
 		user->kill_state = USER_KILL_STATE_KILLING;
--- a/src/director/director.h	Mon Oct 24 20:00:40 2016 +0300
+++ b/src/director/director.h	Mon Oct 24 20:07:26 2016 +0300
@@ -65,6 +65,8 @@
 	struct mail_host_list *orig_config_hosts;
 	/* temporary user -> host associations */
 	struct user_directory *users;
+	/* Number of users currently being moved */
+	unsigned int users_moving_count;
 
 	/* these requests are waiting for directors to be in synced */
 	ARRAY(struct director_request *) pending_requests;
--- a/src/director/main.c	Mon Oct 24 20:00:40 2016 +0300
+++ b/src/director/main.c	Mon Oct 24 20:07:26 2016 +0300
@@ -47,6 +47,8 @@
 
 	str = t_str_new(64);
 	str_printfa(str, "[%u users", user_directory_count(director->users));
+	if (director->users_moving_count > 0)
+		str_printfa(str, ", %u moving", director->users_moving_count);
 	str_printfa(str, ", %lu req/s",
 		    (unsigned long)(director->num_requests - prev_requests));
 	str_printfa(str, ", %llu+%llu kB/s",