mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
Retry with second lambda if connection error
Note, we assume whenever there is a `FunctionError` that there will be a payload that contains an `errorMessage` key. It's implied implicitely in the docs but it's not very explicit. https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_ResponseSyntax
This commit is contained in:
committed by
Pea Tyczynska
parent
9da8e54d69
commit
24f52721f3
@@ -113,7 +113,10 @@ class CBCProxyClientBase(ABC):
|
||||
result = self._invoke_lambda(self.lambda_name, payload_bytes)
|
||||
|
||||
if 'FunctionError' in result:
|
||||
raise CBCProxyException('Function exited with unhandled exception')
|
||||
if result['Payload']['errorType'] == "CBCNewConnectionError":
|
||||
result = self._invoke_lambda(self.failover_lambda_name, payload_bytes)
|
||||
else:
|
||||
raise CBCProxyException('Function exited with unhandled exception')
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user