not retry to send notification for specific http exception

When the host not added in the failover segment, it will raise 400(host
with name *** could not be found). It should not retry to send
notification in this case.

Change-Id: I24a6aba97b834ae92dabe85196f01d27bb518b3c
This commit is contained in:
suzhengwei 2023-01-04 11:25:47 +08:00
parent f8f5bc103d
commit cf646dfce2
1 changed files with 2 additions and 4 deletions

View File

@ -74,10 +74,8 @@ class SendNotification(object):
except Exception as e:
if isinstance(e, exceptions.HttpException):
if e.status_code == 409:
msg = ("Stop retrying to send a notification because "
"same notification have been already sent.")
LOG.info("%s", msg)
if e.status_code in [400, 409]:
LOG.info(e)
break
if retry_count < api_retry_max: