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

Operation timed out (os error 60) - how to reduce/configure the timeout ? #131

Open
nbari opened this issue Oct 24, 2020 · 1 comment
Open

Comments

@nbari
Copy link

nbari commented Oct 24, 2020

How to configure the timeout for the client when making a connection?, for testing I changed port 3306 to a random "closed" port but approximately after a minute the client returns:

Could not connect to MySQL: Input/output error: Input/output error: Operation timed out (os error 60)

I though that conn_ttl could help to reduce the time for trying the connection therefore, I used:

 let opts = mysql_async::OptsBuilder::default()
 .conn_ttl(Duration::new(5, 0));

But still, the client tries to connect for a while.

Is there a way to configure the connection timeout?

I also tried with:

let pool_opts = PoolOpts::default() // before pool_options
.with_inactive_connection_ttl(Duration::from_secs(5));

But still keeps trying for 60 secs

@blackbeam
Copy link
Owner

Hi. There is no tcp_connect_timeout option in mysql_async. Adding this shouldn't be hard (it's already implemented in the synchronous driver), so I'll add it in the next version.
I suggest you to use something like tokio's Timeout until then.

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