Skip to content

Commit

Permalink
Fix Connection.info() json compatibility. Closes #635
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Oct 6, 2016
1 parent 5c80e24 commit ab758f9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions kombu/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,13 @@ class Connection(object):
#: constantly yielding new URLs to try.
failover_strategy = 'round-robin'

#: Map of failover strategy name to Callable
failover_strategies = failover_strategies

#: Heartbeat value, currently only supported by the py-amqp transport.
heartbeat = None


hostname = userid = password = ssl = login_method = None

def __init__(self, hostname='localhost', userid=None,
Expand Down Expand Up @@ -180,8 +184,9 @@ def __init__(self, hostname='localhost', userid=None,

# fallback hosts
self.alt = alt
self.failover_strategy = failover_strategies.get(
failover_strategy or 'round-robin') or failover_strategy
self._failover_strategy_arg = failover_strategy or 'round-robin'
self.failover_strategy = self.failover_strategies.get(
self._failover_strategy_arg) or failover_strategy
if self.alt:
self.cycle = self.failover_strategy(self.alt)
next(self.cycle) # skip first entry
Expand Down Expand Up @@ -560,7 +565,7 @@ def _info(self, resolve=True):
('login_method', self.login_method or D.get('login_method')),
('uri_prefix', self.uri_prefix),
('heartbeat', self.heartbeat),
('failover_strategy', self.failover_strategy),
('failover_strategy', self._failover_strategy_arg),
('alternates', self.alt),
)
return info
Expand Down

0 comments on commit ab758f9

Please sign in to comment.