mosquito / aio-pika

AMQP 0.9 client designed for asyncio and humans.
https://aio-pika.readthedocs.org/
Apache License 2.0
1.18k stars 186 forks source link

Missing heartbeat_last_received in >= 7.0.0 #465

Closed inyutin closed 2 years ago

inyutin commented 2 years ago

Hello! I am just upgraded to 7.0.0 and can't find there "heartbeat_last_received" property in "Connection" class. Moreover I can't find any alternatives for it. And, what's strange, this migration incompatibility not specified in Changelog.

So basically I have three questions:

  1. Am I correct that there are no replacement for "heartbeat_last_received" property?
  2. If so, why you decided to cut it?
  3. May I suggest a pull request with returning of this property? As I see from the code it should be quite easy.
mosquito commented 2 years ago

Yes, unfortunately, I forgot to write about it. The thing is that the algorithm for determining the termination of the heartbeat delivery has been changed in aiormq. Now it is exactly as the protocol described. The determination of the connection health is not based exclusively on the reception and sending of heartbeat packets but the reception of any frames. Thus, receiving of any frame are proves the connection health.

If you need to know the time of last receiving the heartbeat, then this is not a correct rule to make the decision of the connection health. The broker has the right not to send them at all if other frames were sent. The actual behavior of the broker depends on its implementation.

Of course, I can provide metrics about the time of sending and receiving incoming and outgoing frames, and about the flow of frames in general. I had plans to provide an interface for collecting such metrics, but this task is not about returning a single property.

inyutin commented 2 years ago

@mosquito thank you for the clarification. I have no others comments, I think it's possible to close issue then