Adds RMQ reconnection on first timeout after EP run
Execution plan can modify iptables rules causing RabbitMQ connection to break without agent being notified. Thus it will just not get all subsequent execution plans. This commit reestablishes connection upon first 5-second timeout after last executed EP so it it broke the connection it will be fixed in 5 seconds. Change-Id: I90c8e062be8528ffd81a295a209c3ec029fc2cd8 Closes-Bug: #1556895
This commit is contained in:
parent
75faffbb81
commit
d8ece93ac5
|
@ -124,6 +124,7 @@ class MuranoAgent(service.Service):
|
|||
|
||||
def _wait_plan(self):
|
||||
delay = 5
|
||||
reconnect = False
|
||||
while True:
|
||||
try:
|
||||
with self._create_rmq_client() as mq:
|
||||
|
@ -134,10 +135,14 @@ class MuranoAgent(service.Service):
|
|||
if msg is not None and isinstance(msg.body, dict):
|
||||
self._handle_message(msg)
|
||||
|
||||
delay = 5
|
||||
if msg is not None:
|
||||
msg.ack()
|
||||
yield
|
||||
delay = 5
|
||||
reconnect = True
|
||||
elif reconnect:
|
||||
reconnect = False
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
break
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in New Issue