@@ -498,36 +498,59 @@ impl ClientOptions {
498
498
self
499
499
}
500
500
501
- /// Set a request timeout
501
+ /// Set timeout for the overall request
502
502
///
503
- /// The timeout is applied from when the request starts connecting until the
504
- /// response body has finished
503
+ /// The timeout starts from when the request starts connecting until the
504
+ /// response body has finished. If the request does not complete within the
505
+ /// timeout, the client returns a timeout error.
506
+ ///
507
+ /// Timeout errors are retried, subject to the [`RetryConfig`]
505
508
///
506
509
/// Default is 30 seconds
510
+ ///
511
+ /// # See Also
512
+ /// * [`Self::with_timeout_disabled`] to disable the timeout
513
+ /// * [`Self::with_connect_timeout`] to set a timeout for the connect phase
514
+ ///
515
+ /// [`RetryConfig`]: crate::RetryConfig
507
516
pub fn with_timeout ( mut self , timeout : Duration ) -> Self {
508
517
self . timeout = Some ( ConfigValue :: Parsed ( timeout) ) ;
509
518
self
510
519
}
511
520
512
521
/// Disables the request timeout
513
522
///
514
- /// See [`Self::with_timeout`]
523
+ /// # See Also
524
+ /// * [`Self::with_timeout`]
515
525
pub fn with_timeout_disabled ( mut self ) -> Self {
516
526
self . timeout = None ;
517
527
self
518
528
}
519
529
520
530
/// Set a timeout for only the connect phase of a Client
521
531
///
532
+ /// This is the time allowed for the client to establish a connection
533
+ /// and if the connection is not established within this time,
534
+ /// the client returns a timeout error.
535
+ ///
536
+ /// Timeout errors are retried, subject to the [`RetryConfig`]
537
+ ///
522
538
/// Default is 5 seconds
539
+ ///
540
+ /// # See Also
541
+ /// * [`Self::with_timeout`] to set a timeout for the overall request
542
+ /// * [`Self::with_connect_timeout_disabled`] to disable the connect timeout
543
+ ///
544
+ /// [`RetryConfig`]: crate::RetryConfig
523
545
pub fn with_connect_timeout ( mut self , timeout : Duration ) -> Self {
524
546
self . connect_timeout = Some ( ConfigValue :: Parsed ( timeout) ) ;
525
547
self
526
548
}
527
549
528
550
/// Disables the connection timeout
529
551
///
530
- /// See [`Self::with_connect_timeout`]
552
+ /// # See Also
553
+ /// * [`Self::with_connect_timeout`]
531
554
pub fn with_connect_timeout_disabled ( mut self ) -> Self {
532
555
self . connect_timeout = None ;
533
556
self
0 commit comments