]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
indexer: Use a slightly different session ID than the session that requested indexing.
authorTimo Sirainen <tss@iki.fi>
Thu, 24 Sep 2015 13:30:23 +0000 (16:30 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 24 Sep 2015 13:30:23 +0000 (16:30 +0300)
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.

src/indexer/master-connection.c

index a0b13f433aaf33f8888cedc86fe23997249ed29b..cab5f4add2c84d56b396caa6f8d3ffc31f0f4a94 100644 (file)
@@ -212,7 +212,11 @@ master_connection_input_line(struct master_connection *conn, const char *line)
        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) {