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

postgres: use wait_for in disconnect #97

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented May 7, 2019

@blueyed
Copy link
Contributor Author

blueyed commented May 7, 2019

Note that there is also a timeout for acquire, which gets used by release then also: https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/pool.py#L560-L564

@tomchristie
Copy link
Member

This is a good call yup.
Presumably we also want to add the timeout to acquire right?
Any thoughts about adding timeout to the API someplace, and using that value?

Copy link
Contributor

@vmarkovtsev vmarkovtsev left a comment

Choose a reason for hiding this comment

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

Hey @blueyed I can take care of finishing this PR if you don't have time right now. WDYT?

@@ -66,7 +67,7 @@ async def connect(self) -> None:

async def disconnect(self) -> None:
assert self._pool is not None, "DatabaseBackend is not running"
await self._pool.close()
await asyncio.wait_for(self._pool.close(), timeout=30)
Copy link
Contributor

Choose a reason for hiding this comment

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

As @tomchristie wrote, it is a good idea to make the timeout configurable, otherwise, 30 seconds can be too much for everybody.

@blueyed
Copy link
Contributor Author

blueyed commented Jun 4, 2021

@vmarkovtsev

I can take care of finishing this PR if you don't have time right now. WDYT?

Sure, please go ahead.
(Sorry for the late reply, of course)

@taybin
Copy link
Contributor

taybin commented Sep 8, 2021

Any progress on this?

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.

None yet

4 participants