From b7a735c9764cd05a5cb8db8d203940a745486fd9 Mon Sep 17 00:00:00 2001 From: Wing Fung Lau <4760060+hawflau@users.noreply.github.com> Date: Thu, 24 Jun 2021 12:03:27 -0700 Subject: [PATCH 1/2] Update AppConfig boto3 client config to shorten timeout --- samtranslator/feature_toggle/feature_toggle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samtranslator/feature_toggle/feature_toggle.py b/samtranslator/feature_toggle/feature_toggle.py index 2eddcfa1eb..74148d52f5 100644 --- a/samtranslator/feature_toggle/feature_toggle.py +++ b/samtranslator/feature_toggle/feature_toggle.py @@ -135,8 +135,9 @@ def __init__(self, application_id, environment_id, configuration_profile_id): try: LOG.info("Loading feature toggle config from AppConfig...") # Lambda function has 120 seconds limit - # (5 + 25) * 2, 60 seconds maximum timeout duration - client_config = Config(connect_timeout=5, read_timeout=25, retries={"total_max_attempts": 2}) + # (2 + 2) * 3, 12 seconds maximum timeout duration + # In case of high latency from AppConfig, we can always fall back to use an empty config and continue transform + client_config = Config(connect_timeout=2, read_timeout=2, retries={"total_max_attempts": 3}) self.app_config_client = boto3.client("appconfig", config=client_config) response = self.app_config_client.get_configuration( Application=application_id, From 61c3723c2bf04902126a54ab5d55a2c685b36e9e Mon Sep 17 00:00:00 2001 From: Wing Fung Lau <4760060+hawflau@users.noreply.github.com> Date: Thu, 24 Jun 2021 12:10:07 -0700 Subject: [PATCH 2/2] Update timeout config of AppConfig boto3 client --- samtranslator/feature_toggle/feature_toggle.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samtranslator/feature_toggle/feature_toggle.py b/samtranslator/feature_toggle/feature_toggle.py index 74148d52f5..cbfcf2a3cd 100644 --- a/samtranslator/feature_toggle/feature_toggle.py +++ b/samtranslator/feature_toggle/feature_toggle.py @@ -135,9 +135,9 @@ def __init__(self, application_id, environment_id, configuration_profile_id): try: LOG.info("Loading feature toggle config from AppConfig...") # Lambda function has 120 seconds limit - # (2 + 2) * 3, 12 seconds maximum timeout duration + # (5 + 5) * 2, 20 seconds maximum timeout duration # In case of high latency from AppConfig, we can always fall back to use an empty config and continue transform - client_config = Config(connect_timeout=2, read_timeout=2, retries={"total_max_attempts": 3}) + client_config = Config(connect_timeout=5, read_timeout=5, retries={"total_max_attempts": 2}) self.app_config_client = boto3.client("appconfig", config=client_config) response = self.app_config_client.get_configuration( Application=application_id,