changeset 19210:e94781b25c83

indexer: Use a slightly different session ID than the session that requested indexing. Required to avoid "duplicate session ID" errors in stats process. Alternative would have been to change the stats protocol a bit and always send the service name along with session ID, and use those two together as the primary key. Maybe this could be done in future if we get more of these kind of processes.
author Timo Sirainen <tss@iki.fi>
date Thu, 24 Sep 2015 16:30:23 +0300
parents a706bdec0200
children 68dd32223db7
files src/indexer/master-connection.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/indexer/master-connection.c	Thu Sep 24 16:16:43 2015 +0300
+++ b/src/indexer/master-connection.c	Thu Sep 24 16:30:23 2015 +0300
@@ -212,7 +212,11 @@
 	input.module = "mail";
 	input.service = "indexer-worker";
 	input.username = args[0];
-	input.session_id = args[2][0] == '\0' ? NULL : args[2];
+	/* if session-id is given, add -idx suffix to it so that stats process
+	   doesn't complain about duplicates. also it's nicer to keep the stats
+	   separate for the indexer and the caller. */
+	input.session_id = args[2][0] == '\0' ? NULL :
+		t_strconcat(args[2], "-idx", NULL);
 
 	if (mail_storage_service_lookup_next(conn->storage_service, &input,
 					     &service_user, &user, &error) <= 0) {