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

Add expire_conn for service bus connection failures #3

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

erewok
Copy link
Member

@erewok erewok commented Jan 3, 2025

In a recent PR (#1), we expired Eventhub connections from the ManagedEventhubProducer if there were connection issues using those connections. At the time, we noted that this work should also be applied for the ServiceBusSender connections as well in that Managed client.

This PR includes the call to the ConnectionPool.expire_conn method when any of the following exceptions are thrown while trying to schedule a message with the connection:

  • ServiceBusCommunicationError
  • ServiceBusAuthorizationError
  • ServiceBusAuthenticationError
  • ServiceBusConnectionError

All of the above imported from azure.servicebus.exceptions.

It's possible in the future that we will want to amend the list of exceptions that can cause us to expire connections: from reading the docstrings on the exceptions in this module, it seemed like some of the others could also apply. For now, we're using the above.

This test also improves test coverage for the service_bus module, including new tests for the ManagedAzureServiceBusSender class (no tests covered this class previously).

Copy link

github-actions bot commented Jan 6, 2025

Code Coverage

Package Line Rate Health
. 90%
clients 88%
testing_utils 76%
Summary 86% (851 / 984)

@erewok erewok merged commit b48fe4d into main Jan 6, 2025
2 checks passed
@erewok erewok deleted the expire-servicebus-conns-on-failure branch January 6, 2025 20:23
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.

3 participants