Don't tell Qpid to reconnect in a busy loop.

Fix bug 929784.

Don't set any of the reconnect timing options unless they have been set
in the configuration.  Setting them all to zero puts Qpid in a mode
where it will reconnect in a busy loop.  By not setting these unless a
non-zero value has been provided, Qpid goes back to its default
behavior, which is to use an exponential backoff on reconnect attempts
(after 1 second, then 2, 4, 8, etc).

Change-Id: Ia587bbe96db9ea6e429af289c3d586f4c6706648
This commit is contained in:
Russell Bryant
2012-02-09 15:07:51 -05:00
parent db73605c22
commit fa82aeb1e9

View File

@@ -299,13 +299,18 @@ class Connection(object):
self.connection.password = params['password']
self.connection.sasl_mechanisms = FLAGS.qpid_sasl_mechanisms
self.connection.reconnect = FLAGS.qpid_reconnect
self.connection.reconnect_timeout = FLAGS.qpid_reconnect_timeout
self.connection.reconnect_limit = FLAGS.qpid_reconnect_limit
_qpid_reconnect_interval_max = FLAGS.qpid_reconnect_interval_max
self.connection.reconnect_interval_max = _qpid_reconnect_interval_max
_qpid_reconnect_interval_min = FLAGS.qpid_reconnect_interval_min
self.connection.reconnect_interval_min = _qpid_reconnect_interval_min
self.connection.reconnect_interval = FLAGS.qpid_reconnect_interval
if FLAGS.qpid_reconnect_timeout:
self.connection.reconnect_timeout = FLAGS.qpid_reconnect_timeout
if FLAGS.qpid_reconnect_limit:
self.connection.reconnect_limit = FLAGS.qpid_reconnect_limit
if FLAGS.qpid_reconnect_interval_max:
self.connection.reconnect_interval_max = (
FLAGS.qpid_reconnect_interval_max)
if FLAGS.qpid_reconnect_interval_min:
self.connection.reconnect_interval_min = (
FLAGS.qpid_reconnect_interval_min)
if FLAGS.qpid_reconnect_interval:
self.connection.reconnect_interval = FLAGS.qpid_reconnect_interval
self.connection.hearbeat = FLAGS.qpid_heartbeat
self.connection.protocol = FLAGS.qpid_protocol
self.connection.tcp_nodelay = FLAGS.qpid_tcp_nodelay