From 9da8e54d69ea4c4bcc2135acec288525ae4a6ae8 Mon Sep 17 00:00:00 2001 From: David McDonald Date: Mon, 11 Jan 2021 13:46:47 +0000 Subject: [PATCH] Define failover lambdas We will need a lambda to failover to if the first lambda fails. This isn't so much a case of the lambda itself failing, as it is a cross availability zone resource automatically, it's more in case something in the networking goes down in our AZ and therefore the lambda can't call out to the CBC. In this case, we will be able to swap to using the second AZ by calling the second lambda. --- app/clients/cbc_proxy.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/clients/cbc_proxy.py b/app/clients/cbc_proxy.py index df308a6d8..dddf9f076 100644 --- a/app/clients/cbc_proxy.py +++ b/app/clients/cbc_proxy.py @@ -56,6 +56,11 @@ class CBCProxyClientBase(ABC): def lambda_name(self): pass + @property + @abstractmethod + def failover_lambda_name(self): + pass + @property @abstractmethod def LANGUAGE_ENGLISH(self): @@ -136,6 +141,9 @@ class CBCProxyCanary(CBCProxyClientBase): canary, a specific lambda that does not open a vpn or connect to a provider but just responds from within AWS. """ lambda_name = 'canary' + # we don't need a failover lambda for the canary as it doesn't actually make calls out to a CBC + # so we just reuse the normal one in case of a failover scenario + failover_lambda_name = 'canary' LANGUAGE_ENGLISH = None LANGUAGE_WELSH = None @@ -149,6 +157,7 @@ class CBCProxyCanary(CBCProxyClientBase): class CBCProxyEE(CBCProxyClientBase): lambda_name = 'bt-ee-1-proxy' + failover_lambda_name = 'bt-ee-2-proxy' LANGUAGE_ENGLISH = 'en-GB' LANGUAGE_WELSH = 'cy-GB' @@ -208,6 +217,7 @@ class CBCProxyEE(CBCProxyClientBase): class CBCProxyVodafone(CBCProxyClientBase): lambda_name = 'vodafone-1-proxy' + failover_lambda_name = 'vodafone-2-proxy' LANGUAGE_ENGLISH = 'English' LANGUAGE_WELSH = 'Welsh'