-
Notifications
You must be signed in to change notification settings - Fork 230
feat: add cluster metadata request via aiokafka admin client in ping #2212
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
Conversation
faststream/kafka/broker/broker.py
Outdated
if self._admin_client is None: | ||
return False | ||
|
||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we should replace the old logic by new one. Also, this check should respect timeout option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think that in other broker classes(like RabbitMQ and others) the broker.ping
should be checked for an example of a similar bug. But this is beyond the scope of my PR. Just keep it mind
4dd9972
to
0f95ee6
Compare
Tests in |
…v01/faststream into bugfix/ping_kafka_broker
Head branch was pushed to by a user without write access
Description
Add request of the kafka cluster metadata via aiokafka.admin.client.AIOKafkaAdminClient in
broker.ping
method to achieve ping correct work.For now, if you run FastStream application, connected to the Kafka, for example, in docker container and use
broker.ping
in /readiness probe you can encounter a bug:After shutting down a Kafka docker container, broker.ping still respond as True value.
I believe that this is wrong behaviour.
More proper and expected decision is to return False or at least raise an Exception in that case.
Fixes # (issue number)
Type of change
Please delete options that are not relevant.
Checklist
scripts/lint.sh
shows no errors)scripts/test-cov.sh
scripts/static-analysis.sh