From: Timo Sirainen Date: Fri, 1 Jul 2016 13:34:26 +0000 (+0300) Subject: dict-client: Don't log slow background async commit/iteration replies. X-Git-Tag: 2.2.26~517 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e0b20cec3a8d88f4c6a757a5f77ca889ed1221a4;p=thirdparty%2Fdovecot%2Fcore.git dict-client: Don't log slow background async commit/iteration replies. If a caller has already finished iteration, or does async commit without a callback, it means that it started the query without caring when it finishes. The caller may already have been doing blocking work while waiting for the dict reply. We don't want to log a warning, because it could be completely wrong. --- diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index 5cfc7809dc..9d9eff4144 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -36,6 +36,7 @@ struct client_dict_cmd { bool retry_errors; bool no_replies; bool unfinished; + bool background; void (*callback)(struct client_dict_cmd *cmd, const char *line, const char *error); @@ -361,7 +362,8 @@ static int dict_conn_input_line(struct connection *_conn, const char *line) /* more lines needed for this command */ return 1; } - diff = timeval_diff_msecs(&ioloop_timeval, &cmds[0]->start_time); + diff = cmds[0]->background ? 0 : + timeval_diff_msecs(&ioloop_timeval, &cmds[0]->start_time); if (diff >= DICT_CLIENT_REQUEST_WARN_TIMEOUT_MSECS) { i_warning("read(%s): dict lookup took %u.%03u seconds: %s", dict->conn.conn.name, diff/1000, diff % 1000, @@ -712,6 +714,9 @@ client_dict_iter_async_callback(struct client_dict_cmd *cmd, const char *line, struct client_dict_iter_result *result; const char *key = NULL, *value = NULL; + if (ctx->deinit) + cmd->background = TRUE; + if (error != NULL) { /* failed */ } else switch (*line) { @@ -929,6 +934,8 @@ client_dict_transaction_commit(struct dict_transaction_context *_ctx, } else { cmd->api_callback.commit = commit_sync_callback; cmd->api_callback.context = &ret; + if (async) + cmd->background = TRUE; } if (client_dict_cmd_send(dict, &cmd, NULL)) { if (!async)