fix timeout bug
This commit is contained in:
@@ -77,9 +77,14 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
},
|
},
|
||||||
cls=Encoder,
|
cls=Encoder,
|
||||||
)
|
)
|
||||||
# Send template URI and data to Paperforge API to generate a PDF
|
|
||||||
r = requests.post(PAPERFORGE_API, data=json_data)
|
try:
|
||||||
r.raise_for_status()
|
# 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
|
||||||
|
|
||||||
emailmsg = Message(
|
emailmsg = Message(
|
||||||
from_=EMAIL_SENDER,
|
from_=EMAIL_SENDER,
|
||||||
|
|||||||
@@ -366,6 +366,7 @@ Resources:
|
|||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
Properties:
|
Properties:
|
||||||
Handler: events.reporting.send_report_email.lambda_handler
|
Handler: events.reporting.send_report_email.lambda_handler
|
||||||
|
Timeout: 12
|
||||||
LoggingConfig:
|
LoggingConfig:
|
||||||
LogGroup: !Ref EventLog
|
LogGroup: !Ref EventLog
|
||||||
Policies:
|
Policies:
|
||||||
|
|||||||
@@ -47,9 +47,14 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
},
|
},
|
||||||
cls=Encoder,
|
cls=Encoder,
|
||||||
)
|
)
|
||||||
# Send template URI and data to Paperforge API to generate a PDF
|
|
||||||
r = requests.post(PAPERFORGE_API, data=json_data)
|
try:
|
||||||
r.raise_for_status()
|
# 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'
|
object_key = f'billing/{org_id}/{start_date}_{end_date}.pdf'
|
||||||
s3_uri = f's3://{BUCKET_NAME}/{object_key}'
|
s3_uri = f's3://{BUCKET_NAME}/{object_key}'
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Globals:
|
|||||||
Architectures:
|
Architectures:
|
||||||
- x86_64
|
- x86_64
|
||||||
Layers:
|
Layers:
|
||||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:99
|
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:100
|
||||||
Environment:
|
Environment:
|
||||||
Variables:
|
Variables:
|
||||||
TZ: America/Sao_Paulo
|
TZ: America/Sao_Paulo
|
||||||
@@ -102,7 +102,7 @@ Resources:
|
|||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
Properties:
|
Properties:
|
||||||
Handler: events.billing.close_window.lambda_handler
|
Handler: events.billing.close_window.lambda_handler
|
||||||
Timeout: 26
|
Timeout: 12
|
||||||
LoggingConfig:
|
LoggingConfig:
|
||||||
LogGroup: !Ref EventLog
|
LogGroup: !Ref EventLog
|
||||||
Policies:
|
Policies:
|
||||||
@@ -128,7 +128,6 @@ Resources:
|
|||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
Properties:
|
Properties:
|
||||||
Handler: events.billing.send_email_on_closing.lambda_handler
|
Handler: events.billing.send_email_on_closing.lambda_handler
|
||||||
Timeout: 26
|
|
||||||
LoggingConfig:
|
LoggingConfig:
|
||||||
LogGroup: !Ref EventLog
|
LogGroup: !Ref EventLog
|
||||||
Policies:
|
Policies:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Globals:
|
|||||||
Architectures:
|
Architectures:
|
||||||
- x86_64
|
- x86_64
|
||||||
Layers:
|
Layers:
|
||||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:99
|
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:100
|
||||||
Environment:
|
Environment:
|
||||||
Variables:
|
Variables:
|
||||||
LOG_LEVEL: DEBUG
|
LOG_LEVEL: DEBUG
|
||||||
@@ -27,17 +27,17 @@ Resources:
|
|||||||
MeilisearchLog:
|
MeilisearchLog:
|
||||||
Type: AWS::Logs::LogGroup
|
Type: AWS::Logs::LogGroup
|
||||||
Properties:
|
Properties:
|
||||||
RetentionInDays: 90
|
RetentionInDays: 30
|
||||||
|
|
||||||
EventBusLog:
|
EventBusLog:
|
||||||
Type: AWS::Logs::LogGroup
|
Type: AWS::Logs::LogGroup
|
||||||
Properties:
|
Properties:
|
||||||
RetentionInDays: 90
|
RetentionInDays: 30
|
||||||
|
|
||||||
EventPostgresLog:
|
PostgresLog:
|
||||||
Type: AWS::Logs::LogGroup
|
Type: AWS::Logs::LogGroup
|
||||||
Properties:
|
Properties:
|
||||||
RetentionInDays: 90
|
RetentionInDays: 30
|
||||||
|
|
||||||
EventIndexDocsIntoMeiliFunction:
|
EventIndexDocsIntoMeiliFunction:
|
||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
@@ -131,7 +131,7 @@ Resources:
|
|||||||
Properties:
|
Properties:
|
||||||
Handler: events.replicate_into_postgres.lambda_handler
|
Handler: events.replicate_into_postgres.lambda_handler
|
||||||
LoggingConfig:
|
LoggingConfig:
|
||||||
LogGroup: !Ref EventPostgresLog
|
LogGroup: !Ref PostgresLog
|
||||||
Events:
|
Events:
|
||||||
Users:
|
Users:
|
||||||
Type: DynamoDB
|
Type: DynamoDB
|
||||||
|
|||||||
Reference in New Issue
Block a user