diff --git a/cql3/statements/batch_statement.cc b/cql3/statements/batch_statement.cc index d3655ff9c9..e2d52538c3 100644 --- a/cql3/statements/batch_statement.cc +++ b/cql3/statements/batch_statement.cc @@ -59,6 +59,10 @@ timeout_for_type(batch_statement::type t) { : &timeout_config::write_timeout; } +db::timeout_clock::duration batch_statement::get_timeout(const query_options& options) const { + return _attrs->is_timeout_set() ? _attrs->get_timeout(options) : options.get_timeout_config().*get_timeout_config_selector(); +} + batch_statement::batch_statement(int bound_terms, type type_, std::vector statements, std::unique_ptr attrs, @@ -286,7 +290,7 @@ future> batch_statement::do_ ++_stats.batches; _stats.statements_in_batches += _statements.size(); - auto timeout = db::timeout_clock::now() + options.get_timeout_config().*get_timeout_config_selector(); + auto timeout = db::timeout_clock::now() + get_timeout(options); return get_mutations(storage, options, timeout, local, now, query_state).then([this, &storage, &options, timeout, tr_state = query_state.get_trace_state(), permit = query_state.get_permit()] (std::vector ms) mutable { return execute_without_conditions(storage, std::move(ms), options.get_consistency(), timeout, std::move(tr_state), std::move(permit)); diff --git a/cql3/statements/batch_statement.hh b/cql3/statements/batch_statement.hh index 0de04c2410..9d7970765c 100644 --- a/cql3/statements/batch_statement.hh +++ b/cql3/statements/batch_statement.hh @@ -170,6 +170,8 @@ private: service::storage_proxy& storage, const query_options& options, service::query_state& state) const; + + db::timeout_clock::duration get_timeout(const query_options& options) const; public: // FIXME: no cql_statement::to_string() yet #if 0