@@ -63,6 +63,8 @@ pub struct Session {
6363 metrics : Arc < Metrics > ,
6464 default_consistency : Consistency ,
6565 auto_await_schema_agreement_timeout : Option < Duration > ,
66+ #[ allow( dead_code) ]
67+ request_timeout : Option < Duration > ,
6668}
6769
6870/// This implementation deliberately omits some details from Cluster in order
@@ -120,7 +122,7 @@ pub struct SessionConfig {
120122 pub auth_password : Option < String > ,
121123
122124 pub schema_agreement_interval : Duration ,
123- pub connect_timeout : std :: time :: Duration ,
125+ pub connect_timeout : Duration ,
124126
125127 /// Size of the per-node connection pool, i.e. how many connections the driver should keep to each node.
126128 /// The default is `PerShard(1)`, which is the recommended setting for Scylla clusters.
@@ -141,6 +143,10 @@ pub struct SessionConfig {
141143 /// Controls the timeout for the automatic wait for schema agreement after sending a schema-altering statement.
142144 /// If `None`, the automatic schema agreement is disabled.
143145 pub auto_await_schema_agreement_timeout : Option < Duration > ,
146+
147+ /// Controls the client-side timeout for queries.
148+ /// If `None`, the queries have no timeout (the driver will block indefinitely).
149+ pub request_timeout : Option < Duration > ,
144150}
145151
146152/// Describes database server known on Session startup.
@@ -176,13 +182,14 @@ impl SessionConfig {
176182 ssl_context : None ,
177183 auth_username : None ,
178184 auth_password : None ,
179- connect_timeout : std :: time :: Duration :: from_secs ( 5 ) ,
185+ connect_timeout : Duration :: from_secs ( 5 ) ,
180186 connection_pool_size : Default :: default ( ) ,
181187 disallow_shard_aware_port : false ,
182188 default_consistency : Consistency :: LocalQuorum ,
183189 fetch_schema_metadata : true ,
184190 keepalive_interval : None ,
185191 auto_await_schema_agreement_timeout : Some ( std:: time:: Duration :: from_secs ( 60 ) ) ,
192+ request_timeout : Some ( Duration :: from_secs ( 30 ) ) ,
186193 }
187194 }
188195
@@ -374,6 +381,7 @@ impl Session {
374381 metrics : Arc :: new ( Metrics :: new ( ) ) ,
375382 default_consistency : config. default_consistency ,
376383 auto_await_schema_agreement_timeout : config. auto_await_schema_agreement_timeout ,
384+ request_timeout : config. request_timeout ,
377385 } ;
378386
379387 if let Some ( keyspace_name) = config. used_keyspace {
0 commit comments