Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Change heartbeat negotiation strategy #874
@@ Coverage Diff @@ ## master #874 +/- ## ======================================= Coverage 81.98% 81.98% ======================================= Files 20 20 Lines 3664 3664 Branches 545 545 ======================================= Hits 3004 3004 Misses 513 513 Partials 147 147
changed the title from
update heartbeat determin policy when tune
update heartbeat determine policy when tune
Sep 6, 2017
This is generally in line with what Bunny and Java client do (https://github.com/ruby-amqp/bunny/blob/master/lib/bunny/session.rb#L1172, https://github.com/ruby-amqp/bunny/blob/master/lib/bunny/session.rb#L1259) but I'd like to take a closer look.
Oct 2, 2017
added a commit
this pull request
Oct 2, 2017
@zjj I don't think "flexibility" is a good enough justification for inconsistent behaviour between clients when it comes to heartbeat negotiation. Or perhaps I misunderstood your comment.
I pushed an update that changes heartbeat negotiation logic to be the same as in Java client, which accomplishes the same goal: the smallest value of the two will be used when both client and server provide non-zero values.
Releasing this in 0.11.1 seems OK: for the majority of users nothing will change. In other cases a lower value will be used, which is safe unless the values are really low (< 5 seconds is known to produce false positives often enough). Arguably this is a bug fix: the logic is now consistent with that of multiple other widely used clients (Java, .NET, Bunny) and it's closer to "doing the right thing" if you consider what the goal of having heartbeats in the protocol is.
Is 0 supposed to still turn off heartbeats? If so it looks like there's still an issue related to recent changes in the 11.1 or 11.2 release:
With this there's no way 0 can turn off heartbeats, unless the server is set to 0 as well which invalidates the purpose of the 0 switch. Else if the functionality has changed the doc should be updated to indicate that 0 no longer switches off heartbeats.