From 0ccb3e684c4e49210b2011c3450e09a5c68e2c67 Mon Sep 17 00:00:00 2001 From: Jarno Rantanen Date: Fri, 24 Apr 2020 12:13:34 +0300 Subject: [PATCH 1/3] Change data dump scheduling so it only runs 4 times per day. --- infra/modules/main/backend.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infra/modules/main/backend.tf b/infra/modules/main/backend.tf index 00a937cf..b9cb3228 100644 --- a/infra/modules/main/backend.tf +++ b/infra/modules/main/backend.tf @@ -49,8 +49,8 @@ module "backend_worker" { function_s3_bucket = aws_s3_bucket.backend_code.id function_zipfile = "backend-lambda.zip" function_handler = "index.workerEntrypoint" - function_timeout = 60 * 5 # i.e. 5 minutes - schedule_expression = "rate(15 minutes)" # note: full cron expressions are also supported + function_timeout = 60 * 5 # i.e. 5 minutes + schedule_expression = "cron(0 0,6,12,18 * * *)" # note: simple "rate(15 minutes)" expressions are also supported lambda_logging_enabled = true function_env_vars = local.lambda_env } From 06010613d969732b0214c6cf74e82e38cda7fba8 Mon Sep 17 00:00:00 2001 From: Jarno Rantanen Date: Fri, 24 Apr 2020 12:15:12 +0300 Subject: [PATCH 2/3] Update backend timeout to be a bit more liberal. --- infra/modules/main/backend.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/modules/main/backend.tf b/infra/modules/main/backend.tf index b9cb3228..06191bc4 100644 --- a/infra/modules/main/backend.tf +++ b/infra/modules/main/backend.tf @@ -49,7 +49,7 @@ module "backend_worker" { function_s3_bucket = aws_s3_bucket.backend_code.id function_zipfile = "backend-lambda.zip" function_handler = "index.workerEntrypoint" - function_timeout = 60 * 5 # i.e. 5 minutes + function_timeout = 60 * 10 # i.e. 10 minutes schedule_expression = "cron(0 0,6,12,18 * * *)" # note: simple "rate(15 minutes)" expressions are also supported lambda_logging_enabled = true function_env_vars = local.lambda_env From 19687b30290010ae5fee47bbbdf2c46295039bfd Mon Sep 17 00:00:00 2001 From: Jarno Rantanen Date: Fri, 24 Apr 2020 12:35:27 +0300 Subject: [PATCH 3/3] Fix cron expression to be of AWS flavor. --- infra/modules/main/backend.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infra/modules/main/backend.tf b/infra/modules/main/backend.tf index 06191bc4..10afe1bb 100644 --- a/infra/modules/main/backend.tf +++ b/infra/modules/main/backend.tf @@ -49,8 +49,8 @@ module "backend_worker" { function_s3_bucket = aws_s3_bucket.backend_code.id function_zipfile = "backend-lambda.zip" function_handler = "index.workerEntrypoint" - function_timeout = 60 * 10 # i.e. 10 minutes - schedule_expression = "cron(0 0,6,12,18 * * *)" # note: simple "rate(15 minutes)" expressions are also supported + function_timeout = 60 * 10 # i.e. 10 minutes + schedule_expression = "cron(0 0,6,12,18 * * ? *)" # as in (Minutes Hours Day-of-month Month Day-of-week Year); see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html lambda_logging_enabled = true function_env_vars = local.lambda_env }