Return 503 if engine overloaded/unresponsive
When the policy engine is present, but an RPC call to it in the course of fulfilling an API request times out, the error code returned to the API caller is 404 rather than the more appropriate 503 (service (temporarily) unavailable). Change-Id: I5545500ff1c1a4b6e846b810319ad52218ed70fa Closes-Bug: 1785345
This commit is contained in:
parent
5276a6d4ba
commit
dd7c7d6c49
|
@ -334,7 +334,7 @@ class DseNode(object):
|
|||
except (messaging_exceptions.MessagingTimeout,
|
||||
messaging_exceptions.MessageDeliveryFailure):
|
||||
msg = "Request to service '%s' timed out"
|
||||
raise exception.NotFound(msg % service_id)
|
||||
raise exception.Unavailable(msg % service_id)
|
||||
LOG.trace("<%s> RPC call returned: %s", self.node_id, result)
|
||||
return result
|
||||
|
||||
|
|
|
@ -132,6 +132,11 @@ class NotFound(CongressException):
|
|||
code = 404
|
||||
|
||||
|
||||
class Unavailable(CongressException):
|
||||
msg_fmt = _("Service Unavailable.")
|
||||
code = 503
|
||||
|
||||
|
||||
class PolicyNotAuthorized(Forbidden):
|
||||
msg_fmt = _("Policy doesn't allow %(action)s to be performed.")
|
||||
|
||||
|
|
Loading…
Reference in New Issue