Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set default request timeout of 60 seconds, configurable #382

Merged
merged 4 commits into from
Nov 18, 2021

Conversation

jeremyandrews
Copy link
Member

@jeremyandrews jeremyandrews commented Nov 11, 2021

  • #382 set client timeout to 60 seconds by default, used for all requests made; introduce --timeout VALUE where VALUE is seconds as integer or a float; timeout can be configured programatically using GooseDefault::Timeout
  • introduces utils::get_float_from_string(), now used by utils::get_hatch_rate()
  • updates set_client_builder() documentation to reflect how this changes the default Reqwest Client configuration

Comment on lines +368 to +384
/// ```rust
/// use goose::util;
///
/// // No decimal returns a proper float.
/// assert_eq!(util::get_float_from_string(Some("1".to_string())), Some(1.0));
///
/// // Leading decimal returns a proper float.
/// assert_eq!(util::get_float_from_string(Some(".1".to_string())), Some(0.1));
///
/// // Valid float string returns a proper float.
/// assert_eq!(util::get_float_from_string(Some("1.1".to_string())), Some(1.1));
///
/// // Invalid number with too many decimals returns None.
/// assert_eq!(util::get_float_from_string(Some("1.1.1".to_string())), None);
///
/// // No number returns None.
/// assert_eq!(util::get_float_from_string(None), None);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love doc tests!

Copy link
Collaborator

@slashrsm slashrsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to my (n00b) me.

src/config.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@LionsAd LionsAd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTBM

@jeremyandrews jeremyandrews merged commit 4434591 into tag1consulting:main Nov 18, 2021
@jeremyandrews jeremyandrews mentioned this pull request Nov 19, 2021
@jeremyandrews jeremyandrews deleted the timeout branch December 23, 2021 15:36
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants