From b96d30745eb4c8beaccc50227485f71dec1d056a Mon Sep 17 00:00:00 2001 From: Noa Aviel Dove Date: Tue, 24 Oct 2023 19:35:07 -0700 Subject: [PATCH] Use long terra timeout in indexer lambdas --- src/azul/__init__.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/azul/__init__.py b/src/azul/__init__.py index e8182d2d6..422ae9560 100644 --- a/src/azul/__init__.py +++ b/src/azul/__init__.py @@ -1147,8 +1147,22 @@ def _timing_is_restricted(self) -> bool: if self.lambda_context is None: return False else: - remaining = self.lambda_context.get_remaining_time_in_millis() / 1000 - return remaining <= self.api_gateway_lambda_timeout + function_name = self.lambda_context.function_name + try: + _, app_name, _ = self.unqualified_resource_name_and_suffix(function_name) + except RequirementError: + from chalice.constants import ( + DEFAULT_HANDLER_NAME, + ) + assert function_name == DEFAULT_HANDLER_NAME, function_name + return False + else: + if app_name == 'service': + remaining = self.lambda_context.get_remaining_time_in_millis() / 1000 + return remaining <= self.api_gateway_lambda_timeout + else: + assert app_name == 'indexer', (function_name, app_name) + return False @property def terra_client_timeout(self) -> float: