fix timeout bug

This commit is contained in:
2025-11-01 15:57:43 -03:00
parent 26a87b8445
commit d6c26df63b
5 changed files with 25 additions and 15 deletions

View File

@@ -47,9 +47,14 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
},
cls=Encoder,
)
# Send template URI and data to Paperforge API to generate a PDF
r = requests.post(PAPERFORGE_API, data=json_data)
r.raise_for_status()
try:
# Send template URI and data to Paperforge API to generate a PDF
r = requests.post(PAPERFORGE_API, data=json_data, timeout=6)
r.raise_for_status()
except requests.exceptions.Timeout:
logger.info('The request timed out')
raise
object_key = f'billing/{org_id}/{start_date}_{end_date}.pdf'
s3_uri = f's3://{BUCKET_NAME}/{object_key}'

View File

@@ -26,7 +26,7 @@ Globals:
Architectures:
- x86_64
Layers:
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:99
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:100
Environment:
Variables:
TZ: America/Sao_Paulo
@@ -102,7 +102,7 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: events.billing.close_window.lambda_handler
Timeout: 26
Timeout: 12
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
@@ -128,7 +128,6 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: events.billing.send_email_on_closing.lambda_handler
Timeout: 26
LoggingConfig:
LogGroup: !Ref EventLog
Policies: