FastStream is a powerful and easy-to-use Python framework for building asynchronous services interacting with event streams such as Apache Kafka, RabbitMQ, NATS and Redis.
I have a situation where RabbitMQ is up, a service is up with a successful connection to RabbitMQ, I stop it, a reconnection occurs to it every n seconds.
in fact there is no connection, my /readiness handle returns 204, although the service is not readiness.
the ping method checks the connection's is_closed flag, although this is not entirely correct, because it will be True only when close/__del__/__aexit__ is called on the connection
checking the connected attribute of the connection object will be more objective: True when there is a connection, False when there is not (there was no connection right away, or a reconnection occurs)
Type of change
[x] Bug fix (a non-breaking change that resolves an issue)
Checklist
[x] My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
[x] I have conducted a self-review of my own code
[x] I have made the necessary changes to the documentation
[x] My changes do not generate any new warnings
[x] I have added tests to validate the effectiveness of my fix or the functionality of my new feature
[x] Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
[x] I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
[x] I have included code examples to illustrate the modifications
Description
I have a situation where RabbitMQ is up, a service is up with a successful connection to RabbitMQ, I stop it, a reconnection occurs to it every n seconds.
in fact there is no connection, my /readiness handle returns 204, although the service is not readiness.
the ping method checks the connection's
is_closed
flag, although this is not entirely correct, because it will beTrue
only whenclose
/__del__
/__aexit__
is called on the connectionchecking the
connected
attribute of theconnection
object will be more objective:True
when there is a connection,False
when there is not (there was no connection right away, or a reconnection occurs)Type of change
Checklist
scripts/lint.sh
shows no errors)scripts/test-cov.sh
scripts/static-analysis.sh