Mithronn / rusty_ytdl

A Rust library for Youtube video searcher and downloader
https://docs.rs/rusty_ytdl
MIT License
107 stars 20 forks source link

Make max retries configurable #33

Closed nick42d closed 3 months ago

nick42d commented 3 months ago

Perhaps more unlikely with the new changes from 3.8.24, but it could be still possible for chunk max retries to be insufficient. This PR allows library consumers to override the default number of retries. Used an Option in RequestOptions to work in with the derive(Default).

IMO - resolves #32.

Mithronn commented 3 months ago
    /// Number of retries to allow per web request (ie, per chunk downloaded)
    /// Default is [`crate::constants::DEFAULT_RETRIES`].
    ///
    /// # Example
    /// 
    ///     // Allow 5 retries per chunk.
    ///     let video_options = VideoOptions {
    ///          request_options: RequestOptions {
    ///               max_retries: Some(5),
    ///                ..Default::default()
    ///          },
    ///          ..Default::default()
    ///     };
    /// 
    pub max_retries: Option<u32>,

max_retries more suitable for the option name

nick42d commented 3 months ago
    /// Number of retries to allow per web request (ie, per chunk downloaded)
    /// Default is [`crate::constants::DEFAULT_RETRIES`].
    ///
    /// # Example
    /// 
    ///     // Allow 5 retries per chunk.
    ///     let video_options = VideoOptions {
    ///          request_options: RequestOptions {
    ///               max_retries: Some(5),
    ///                ..Default::default()
    ///          },
    ///          ..Default::default()
    ///     };
    /// 
    pub max_retries: Option<u32>,

max_retries more suitable for the option name

Updated now!