Skip to content

Rename _Retry to _RetryConnectSignal #723

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

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions asyncpg/connect_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ async def _connect_addr(
before = time.monotonic()
try:
return await __connect_addr(params, timeout, True, *args)
except _Retry:
except _RetryConnectSignal:
pass

# second attempt
Expand All @@ -641,7 +641,7 @@ async def _connect_addr(
return await __connect_addr(params_retry, timeout, False, *args)


class _Retry(Exception):
class _RetryConnectSignal(Exception):
pass


Expand Down Expand Up @@ -687,7 +687,7 @@ async def __connect_addr(
tr.close()

# retry=True here is a redundant check because we don't want to
# accidentally raise the internal _Retry to the outer world
# accidentally raise the internal _RetryConnectSignal to the user
if retry and (
params.sslmode == SSLMode.allow and not pr.is_ssl or
params.sslmode == SSLMode.prefer and pr.is_ssl
Expand All @@ -697,7 +697,7 @@ async def __connect_addr(
# 2. First attempt with sslmode=prefer, ssl=ctx failed while the
# server claimed to support SSL (returning "S" for SSLRequest)
# (likely because pg_hba.conf rejected the connection)
raise _Retry()
raise _RetryConnectSignal()

else:
# but will NOT retry if:
Expand Down