Mercurial > dovecot > core-2.2
changeset 20484:3e15ee9c7832
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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 01 Jul 2016 16:34:26 +0300 |
parents | 80e064878fab |
children | 4c5e4a4fbc9e |
files | src/lib-dict/dict-client.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-dict/dict-client.c Fri Jul 01 16:31:52 2016 +0300 +++ b/src/lib-dict/dict-client.c Fri Jul 01 16:34:26 2016 +0300 @@ -36,6 +36,7 @@ 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 @@ /* 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 @@ 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 @@ } 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)