Merge "Skip notification retry processing when HTTP status is 409"

This commit is contained in:
Jenkins 2017-02-16 08:27:48 +00:00 committed by Gerrit Code Review
commit fff47b7105

View File

@ -14,6 +14,7 @@
import eventlet import eventlet
from openstack import connection from openstack import connection
from openstack import exceptions
from openstack import profile from openstack import profile
from oslo_log import log as oslo_logging from oslo_log import log as oslo_logging
@ -96,6 +97,14 @@ class SendNotification(object):
break break
except Exception as e: except Exception as e:
if isinstance(e, exceptions.HttpException):
# If http_status is 409, skip the retry processing.
if e.http_status == 409:
msg = ("Stop retrying to send a notification because "
"same notification have been already sent.")
LOG.info(_LI("%s"), msg)
break
if retry_count < api_retry_max: if retry_count < api_retry_max:
LOG.warning(_LW("Retry sending a notification. (%s)"), e) LOG.warning(_LW("Retry sending a notification. (%s)"), e)
retry_count = retry_count + 1 retry_count = retry_count + 1