/* include timing info always in error messages */
result.error = t_strdup_printf("%s (reply took %s)",
result.error, dict_warnings_sec(cmd, diff, extra_args));
- } else if (!cmd->background && !cmd->trans->ctx.no_slowness_warning &&
+ } else if (!cmd->background && !cmd->trans->ctx.set.no_slowness_warning &&
diff >= (int)dict->warn_slow_msecs) {
e_warning(dict->conn.conn.event, "dict commit took %s: "
"%s (%u commands, first: %s)",
struct dict_op_settings_private {
char *username;
char *home_dir;
+ bool no_slowness_warning;
};
struct dict {
struct timespec timestamp;
bool changed:1;
- bool no_slowness_warning:1;
};
void dict_transaction_commit_async_noop_callback(
return ctx;
}
-void dict_transaction_no_slowness_warning(struct dict_transaction_context *ctx)
-{
- ctx->no_slowness_warning = TRUE;
-}
-
void dict_transaction_set_timestamp(struct dict_transaction_context *ctx,
const struct timespec *ts)
{
i_zero(dest_r);
dest_r->username = i_strdup(source->username);
dest_r->home_dir = i_strdup(source->home_dir);
+ dest_r->no_slowness_warning = source->no_slowness_warning;
}
void dict_op_settings_private_free(struct dict_op_settings_private *set)
const char *username;
/* home directory for the user, if known */
const char *home_dir;
+
+ /* Don't log a warning if the transaction commit took a long time.
+ This is needed if there are no guarantees that an asynchronous
+ commit will finish up anytime soon. Mainly useful for transactions
+ which aren't especially important whether they finish or not. */
+ bool no_slowness_warning;
};
struct dict_lookup_result {
/* Start a new dictionary transaction. */
struct dict_transaction_context *
dict_transaction_begin(struct dict *dict, const struct dict_op_settings *set);
-/* Don't log a warning if the transaction commit took a long time.
- This is needed if there are no guarantees that an asynchronous commit will
- finish up anytime soon. Mainly useful for transactions which aren't
- especially important whether they finish or not. */
-void dict_transaction_no_slowness_warning(struct dict_transaction_context *ctx);
/* Set write timestamp for the entire transaction. This must be set before
any changes are done and can't be changed afterwards. Currently only
dict-sql with Cassandra backend does anything with this. */
precision = mail_user_plugin_getenv(user, "last_login_precision");
- const struct dict_op_settings *dset = mail_user_get_dict_op_settings(user);
- trans = dict_transaction_begin(dict, dset);
+ struct dict_op_settings dset = *mail_user_get_dict_op_settings(user);
+ dset.no_slowness_warning = TRUE;
+ trans = dict_transaction_begin(dict, &dset);
if (precision == NULL || strcmp(precision, "s") == 0)
dict_set(trans, key_name, dec2str(ioloop_time));
else if (strcmp(precision, "ms") == 0) {
} else {
i_error("last_login_dict: Invalid last_login_precision '%s'", precision);
}
- dict_transaction_no_slowness_warning(trans);
dict_transaction_commit_async(&trans, last_login_dict_commit, user);
}