Skip to content

Commit

Permalink
fix: If the client attempts to close the connection while it is openi…
Browse files Browse the repository at this point in the history
…ng, do not retry opening the connection.
  • Loading branch information
jpmckinney committed Jan 23, 2024
1 parent 5391925 commit 63db184
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Changed
- Remove log message for declaring exchange.
- Remove ``yapw.clients.Base.__getsafe__``.

Fixed
~~~~~

- If the client attempts to close the connection while it is opening, do not retry opening the connection.

0.1.3 (2023-07-03)
------------------

Expand Down
4 changes: 2 additions & 2 deletions yapw/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import pika
from pika.adapters.asyncio_connection import AsyncioConnection
from pika.exceptions import ProbableAccessDeniedError, ProbableAuthenticationError
from pika.exceptions import ConnectionOpenAborted, ProbableAccessDeniedError, ProbableAuthenticationError
from pika.exchange_type import ExchangeType

from yapw.decorators import halt
Expand Down Expand Up @@ -438,7 +438,7 @@ def reset(self) -> None:

def connection_open_error_callback(self, connection: pika.connection.Connection, error: Exception | str) -> None:
"""Retry, once the connection couldn't be established."""
if isinstance(error, ProbableAccessDeniedError | ProbableAuthenticationError):
if isinstance(error, ConnectionOpenAborted | ProbableAccessDeniedError | ProbableAuthenticationError):
logger.error("Stopping: %r", error)
self.connection.ioloop.stop()
else:
Expand Down

0 comments on commit 63db184

Please sign in to comment.