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

refactor: remove RabbitQueue & RabbitExchange hashes #2034

Open
Lancetnik opened this issue Jan 11, 2025 · 2 comments
Open

refactor: remove RabbitQueue & RabbitExchange hashes #2034

Lancetnik opened this issue Jan 11, 2025 · 2 comments
Labels
enhancement New feature or request RabbitMQ Issues related to `faststream.rabbit` module and RabbitMQ broker features
Milestone

Comments

@Lancetnik
Copy link
Member

These classes are using to cache real connection objects https://github.com/airtai/faststream/blob/0.6.0/faststream/rabbit/helpers/declarer.py#L15-L16

So, we should use hash to be sure, that user call declarer for the same object
https://github.com/airtai/faststream/blob/0.6.0/faststream/rabbit/schemas/queue.py#L57

Thus, we should make a bunch of unit-tests to be prevent incorrect collisions
https://github.com/airtai/faststream/blob/0.6.0/tests/brokers/rabbit/test_schemas.py

@Lancetnik Lancetnik converted this from a draft issue Jan 11, 2025
@Lancetnik Lancetnik changed the title Add unit tests for RabbitQueue & RabbitExchange hashes refactor: remove RabbitQueue & RabbitExchange hashes Jan 11, 2025
@Lancetnik
Copy link
Member Author

Well, the concept changed - I think, we should use just a names to cache queue & exchanges objects in declarer: https://github.com/airtai/faststream/blob/0.6.0/faststream/rabbit/helpers/declarer.py#L39

To validate queue misconfiguration we should compare returning RMQ object with the passed by user one here - https://github.com/airtai/faststream/blob/0.6.0/faststream/rabbit/helpers/declarer.py#L54 and raise an error if passed queue options differ from the a object

Also, we should make the same for exchanges as well

After these changes we will be able to remove RabbitQueue.__hash__ and RabbitExchange.__hash__ methods at all

@Lancetnik Lancetnik added this to the 0.6.0 milestone Jan 11, 2025
@Lancetnik Lancetnik added enhancement New feature or request RabbitMQ Issues related to `faststream.rabbit` module and RabbitMQ broker features labels Jan 11, 2025
@Lancetnik
Copy link
Member Author

The PR should be open to 0.6.0 branch

@Lancetnik Lancetnik moved this from Todo to In Progress in FastStream Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request RabbitMQ Issues related to `faststream.rabbit` module and RabbitMQ broker features
Projects
Status: In Progress
Development

No branches or pull requests

1 participant