Skip to content

Commit

Permalink
Update exceptions to catch the timeout errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sae126V authored and tofu-rocketry committed Jun 20, 2023
1 parent b1aab5c commit d590639
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ssm/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

from stomp.exception import NotConnectedException
try:
from argo_ams_library import AmsConnectionException
from argo_ams_library import (AmsConnectionException, AmsTimeoutException,
AmsBalancerException)
except ImportError:
# ImportError is raised when Ssm2 initialised if AMS is requested but lib
# not installed.
Expand Down Expand Up @@ -328,7 +329,9 @@ def run_receiver(protocol, brokers, project, token, cp, log, dn_file):
if protocol == Ssm2.STOMP_MESSAGING:
ssm.send_ping()

except (NotConnectedException, AmsConnectionException) as error:
except (NotConnectedException, AmsConnectionException,
AmsTimeoutException, AmsBalancerException) as error:

log.warning('Connection lost.')
log.debug(error)
ssm.shutdown()
Expand Down

0 comments on commit d590639

Please sign in to comment.