Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
amenezes committed Mar 23, 2024
1 parent d52def3 commit 2423e74
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rabbit/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def persistent_connect(self, **kwargs) -> None:
self.transport, self.protocol = await aioamqp.connect(**kwargs)
await self.protocol.wait_closed()
self.transport.close()
except (OSError, aioamqp.exceptions.AmqpClosedConnection) as err:
except (OSError, AmqpClosedConnection) as err:
logger.error(
f"ConnectionError: [error='{err}', host='{kwargs.get('host')}', port={kwargs.get('port')}, login='{kwargs.get('login')}']"
)
Expand Down
3 changes: 1 addition & 2 deletions rabbit/dlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def channel(self, channel: Channel) -> None:
async def configure(self) -> None:
"""Configure DLX channel, queues and exchange."""
try:
await self._configure_queue()
await self._configure_exchange()
await asyncio.gather(self._configure_queue(), self._configure_exchange())
await self._configure_queue_bind()
except AttributeNotInitialized:
logger.debug("Waiting client initialization...DLX")
Expand Down
3 changes: 1 addition & 2 deletions rabbit/subscribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ async def configure(self, channel: Union[None, Channel] = None) -> None:
"""Configure subscriber channel, queues and exchange."""
await self.qos(prefetch_count=self.concurrent)
with suppress(SynchronizationError):
await self._configure_queue()
await self._dlx.configure()
await asyncio.gather(self._configure_queue(), self._dlx.configure())
await self._configure_exchange()
await self._configure_queue_bind()

Expand Down

0 comments on commit 2423e74

Please sign in to comment.