gmr / rabbitpy

A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
http://rabbitpy.readthedocs.org
BSD 3-Clause "New" or "Revised" License
242 stars 58 forks source link

heartbeat can not be set to 0 #69

Closed michaelplaing closed 9 years ago

michaelplaing commented 9 years ago

The internal logic treats 0 as None and sets the default instead. There is no workaround I can see except to set heartbeat to a ridiculously high number.

The real problem however is that my apps are getting heartbeat exceptions even tho there is traffic on the connection. RabbitMQ 3.5.1, python 2.7.9 on Amazon Linux, local connection between client and server.

I believe this is because there has been other traffic sent on the connection during the interval, hence no heartbeat is sent by the server on channel 0. I am checking w Pivotal to confirm my understanding of server behavior.

michaelplaing commented 9 years ago

Oh actually the logic looks OK - I missed a paren - I'll investigate more and comment again.

michaelplaing commented 9 years ago

Ah - the logic in Channel0._negotiate is the culprit: return min(client_value, server_value) or (client_value or server_value) will never return a 0 for heartbeat.

michaelplaing commented 9 years ago

Still leaving the real problem however...

michaelplaing commented 9 years ago

And the same logic prevents the 'ridiculously high number' workaround - hmmm.

gmr commented 9 years ago

I'll look into this ASAP.

michaelplaing commented 9 years ago

Thanks!

On Monday, April 13, 2015, Gavin M. Roy notifications@github.com wrote:

I'll look into this ASAP.

— Reply to this email directly or view it on GitHub https://github.com/gmr/rabbitpy/issues/69#issuecomment-92362452.

gmr commented 9 years ago

I'll release the a new version ASAP (likely tonight)