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

Timeout #17

Open
jfanals opened this issue Mar 31, 2020 · 1 comment
Open

Timeout #17

jfanals opened this issue Mar 31, 2020 · 1 comment

Comments

@jfanals
Copy link

jfanals commented Mar 31, 2020

Is there a way of passing a timeout option (open_timeout, read_timeout, write_timeout) to the http methods?

@ozkrpp
Copy link

ozkrpp commented Sep 9, 2022

This wasn't easy so I will share it in case anyone else is struggling with it. You can pass the timeout_options like this if you want a timeout per operation (there is a global timeout as well but I haven't used it):

get('test', headers: request_headers, timeout_class: HTTP::Timeout::PerOperation, timeout_options: {read_timeout: TIMEOUT_VALUE, write_timeout: TIMEOUT_VALUE})

You can also configure connect_timeout

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

No branches or pull requests

2 participants