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

chore: IDSSE-441: PublishConfirm internal cleanup #38

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

mackenzie-grimes-noaa
Copy link
Contributor

@mackenzie-grimes-noaa mackenzie-grimes-noaa commented Dec 7, 2023

Linear Issue

Changes

  • Consolidate small methods that only exist to be called one time by another method.
  • Add None-check around any usage of self._connection or self._channel
    • They can technically be None, but they never should be after connection/channel is initialized
    • When possible, use the connection arg that pika passes to our callbacks to avoid using the private variable at all.
  • Block attempts to call PublishConfirm.start() more than once
    • This is same behavior as calling Python Thread.start() twice

Also a minor addition to rabbitmq_utils:

  • Added a connection_parameters property to Conn data object.
    • This property can be passed as parameters to any type of pika connection, and is less limited than Conn.to_connection() which is only useful for making a BlockingConnection.

@mackenzie-grimes-noaa mackenzie-grimes-noaa marked this pull request as ready for review December 7, 2023 21:51
Copy link
Contributor

@Geary-Layne Geary-Layne left a comment

Choose a reason for hiding this comment

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

Nice clean up

return BlockingConnection(parameters=self.connection_parameters)

@property
def connection_parameters(self) -> ConnectionParameters:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@mackenzie-grimes-noaa mackenzie-grimes-noaa merged commit 1ce9194 into main Dec 13, 2023
3 checks passed
@mackenzie-grimes-noaa mackenzie-grimes-noaa deleted the chore/publish-confirm-cleanup branch December 13, 2023 17:32
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