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

Unable to set a connect_timeout #257

Closed
terrisgit opened this issue Feb 17, 2018 · 7 comments
Closed

Unable to set a connect_timeout #257

terrisgit opened this issue Feb 17, 2018 · 7 comments

Comments

@terrisgit
Copy link

terrisgit commented Feb 17, 2018

aiomysql==0.0.12

Reading through the code, kwargs passed to create_pool() are captured and passed along. The code looks correct but setting connect_timeout to 1 versus 1000 makes no difference. The timeout is always two minutes and a few seconds. Something like:

pool = await aiomysql.create_pool(user=user, db=database, host=host,
      password=password, port=port, connect_timeout=1 )
@jettify
Copy link
Member

jettify commented Feb 18, 2018

That is a good catch, we need to wrap open_connection into asyncio.wait_for and add pass connect_timeout there

if self._unix_socket and self._host in ('localhost', '127.0.0.1'):
self._reader, self._writer = yield from \
asyncio.open_unix_connection(self._unix_socket,
loop=self._loop)
self.host_info = "Localhost via UNIX socket: " + \
self._unix_socket
else:
self._reader, self._writer = yield from \
asyncio.open_connection(self._host, self._port,
loop=self._loop)
self._set_keep_alive()

@jettify
Copy link
Member

jettify commented Mar 7, 2018

would you like to create PR?

@mpavelka
Copy link

+1, is there a progress?

@terricain
Copy link
Collaborator

Once we've fixed SSL (hopefully in the next few days) I'll PR this, should be simple.

@VeridianDynamics
Copy link

Has this been solved and the issue is just forgotten, or has there been some unforeseen roadblock? Thanks.

@maciej-trebacz
Copy link

@terrycain did you get to implement this PR in the end? Thanks.

@terricain
Copy link
Collaborator

I didn't, I completely forgot 😄, I'll have a crack at this on the weekend unless someone else wishes to do so.

terricain pushed a commit that referenced this issue Dec 4, 2018
* fix the python 3.7 compatibility

* Fixes #257
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

6 participants