Skip to content

Commit 66838b9

Browse files
committed
session: run_query() takes retry policy in StatementConfig
Passing it separately is no longer needed after retry policy is put inside `StatementConfig`.
1 parent 66b06ab commit 66838b9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

scylla/src/transport/session.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use crate::frame::types::LegacyConsistency;
88
use crate::history;
99
use crate::history::HistoryListener;
1010
use crate::prepared_statement::PartitionKeyDecoder;
11-
use crate::retry_policy::RetryPolicy;
1211
use crate::utils::pretty::{CommaSeparatedDisplayer, CqlValueDisplayer};
1312
use arc_swap::ArcSwapOption;
1413
use async_trait::async_trait;
@@ -675,7 +674,6 @@ impl Session {
675674
.run_query(
676675
statement_info,
677676
&query.config,
678-
query.get_retry_policy().map(|rp| &**rp),
679677
execution_profile,
680678
|node: Arc<Node>| async move { node.random_connection().await },
681679
|connection: Arc<Connection>,
@@ -1029,7 +1027,6 @@ impl Session {
10291027
.run_query(
10301028
statement_info,
10311029
&prepared.config,
1032-
prepared.get_retry_policy().map(|rp| &**rp),
10331030
execution_profile,
10341031
|node: Arc<Node>| async move {
10351032
match token {
@@ -1246,7 +1243,6 @@ impl Session {
12461243
.run_query(
12471244
statement_info,
12481245
&batch.config,
1249-
batch.get_retry_policy().map(|rp| &**rp),
12501246
execution_profile,
12511247
|node: Arc<Node>| async move {
12521248
match first_value_token {
@@ -1530,12 +1526,10 @@ impl Session {
15301526
// On success this query's result is returned
15311527
// I tried to make this closures take a reference instead of an Arc but failed
15321528
// maybe once async closures get stabilized this can be fixed
1533-
#[allow(clippy::too_many_arguments)] // <-- remove this once retry policy is put into StatementConfig
15341529
async fn run_query<'a, ConnFut, QueryFut, ResT>(
15351530
&'a self,
15361531
statement_info: RoutingInfo<'a>,
15371532
statement_config: &'a StatementConfig,
1538-
statement_retry_policy: Option<&dyn RetryPolicy>,
15391533
execution_profile: Arc<ExecutionProfileInner>,
15401534
choose_connection: impl Fn(Arc<Node>) -> ConnFut,
15411535
do_query: impl Fn(Arc<Connection>, Consistency, &ExecutionProfileInner) -> QueryFut,
@@ -1580,7 +1574,10 @@ impl Session {
15801574
}
15811575
}
15821576

1583-
let retry_policy = statement_retry_policy.unwrap_or(&*execution_profile.retry_policy);
1577+
let retry_policy = statement_config
1578+
.retry_policy
1579+
.as_deref()
1580+
.unwrap_or(&*execution_profile.retry_policy);
15841581

15851582
let speculative_policy = execution_profile.speculative_execution_policy.as_ref();
15861583

@@ -1858,7 +1855,6 @@ impl Session {
18581855
.run_query(
18591856
info,
18601857
&config,
1861-
None, // No specific retry policy needed for schema agreement
18621858
self.get_default_execution_profile_handle().access(),
18631859
|node: Arc<Node>| async move { node.random_connection().await },
18641860
do_query,

0 commit comments

Comments
 (0)