achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1
MIT License
79 stars 40 forks source link

Raise HeartbeatFailedException after missing maxMissedHeartbeats (new tuning param) consecutive heartbeats #111

Closed achilleasa closed 9 months ago

achilleasa commented 10 months ago

This PR implements a suggestion from https://github.com/achilleasa/dart_amqp/issues/106#issuecomment-1846280852.

The client-side heartbeat implementation is modified via the introduction of a new tuning parameter called maxMissedHeartbeats (default: 3).

If heartbeats are enabled and the client sends maxMissedHeartbeats consecutive heartbeat messages at the interval negotiated with the broker without receiving any message (heartbeat or regular traffic) back, the client assumes that the server is not available and will raise a HeartbeatFailedException.

Fixes #106

github-actions[bot] commented 10 months ago

Coverage Status

coverage: 93.062%. remained the same when pulling 9e52ca9217fe93ab1da3108b03bc0aefafc9ab95 on track-missed-heartbeats into 6cdc538afd03c8c9ab30cc378f79bef5fdc93663 on master.

rajmaniar commented 10 months ago

This implementation looks reasonable and it's similar to what we've been running successfully for about a month now. I'd like to propose an alternative implementation that's a bit simpler which I parked in this draft pr #114

achilleasa commented 9 months ago

TBH, I consider this implementation simpler as the timer will get correctly reset in all scenarios (re-connects e.t.c.). The in-flight tracking PR makes sense but needs more work to make sure that the counter gets correctly reset.

In the meantime I will land this CL so it does not bitrot.