changeset 13195:699d0cebaaa7

indexer-worker: verbose_proctitle=yes now shows username+mailbox.
author Timo Sirainen <tss@iki.fi>
date Tue, 09 Aug 2011 20:05:38 +0300
parents 3c4e3451fd2a
children 9a8c6cdcd5ca
files src/indexer/master-connection.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/indexer/master-connection.c	Tue Aug 09 19:56:54 2011 +0300
+++ b/src/indexer/master-connection.c	Tue Aug 09 20:05:38 2011 +0300
@@ -5,7 +5,9 @@
 #include "istream.h"
 #include "write-full.h"
 #include "strescape.h"
+#include "process-title.h"
 #include "master-service.h"
+#include "master-service-settings.h"
 #include "mail-namespace.h"
 #include "mail-storage.h"
 #include "mail-storage-service.h"
@@ -30,6 +32,18 @@
 	unsigned int version_received:1;
 };
 
+static void
+indexer_worker_refresh_proctitle(const char *username, const char *mailbox)
+{
+	if (!master_service_settings_get(master_service)->verbose_proctitle)
+		return;
+
+	if (username != NULL)
+		process_title_set(t_strdup_printf("[%s %s]", username, mailbox));
+	else
+		process_title_set("[idling]");
+}
+
 static int index_mailbox(struct mail_user *user, const char *mailbox)
 {
 	struct mail_namespace *ns;
@@ -90,7 +104,9 @@
 		i_error("User %s lookup failed: %s", args[0], error);
 		ret = -1;
 	} else {
+		indexer_worker_refresh_proctitle(user->username, args[1]);
 		ret = index_mailbox(user, args[1]);
+		indexer_worker_refresh_proctitle(NULL, NULL);
 		mail_user_unref(&user);
 		mail_storage_service_user_free(&service_user);
 	}