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

Retry publishing for all connection-related errors #176

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion fedora_messaging/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def publish(self, message, exchange=None):
except (pika_errs.NackError, pika_errs.UnroutableError) as e:
_log.warning("Message was rejected by the broker (%s)", str(e))
raise PublishReturned(reason=e)
except (pika_errs.ConnectionClosed, pika_errs.AMQPChannelError):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to stop handling ConnectionClosed here?

Copy link
Member Author

Choose a reason for hiding this comment

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

except (pika_errs.AMQPConnectionError, pika_errs.AMQPChannelError):
# Because this is a blocking connection (and thus can't heartbeat)
# we might need to restart the connection.
_log.info("Resetting connection to %s", self._parameters.host)
Expand Down
2 changes: 1 addition & 1 deletion fedora_messaging/tests/unit/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_connect_and_publish_not_connnected(self):

def test_publish_disconnected(self):
# The publisher must try to re-establish a connection on publish.
self.publisher_channel_publish.side_effect = pika_errs.ConnectionClosed(
self.publisher_channel_publish.side_effect = pika_errs.AMQPConnectionError(
200, "I wanted to"
)
connection_class_mock = mock.Mock()
Expand Down