From ca845c4f7e7062b7f94e6632676af340c1fc7cf8 Mon Sep 17 00:00:00 2001 From: Remi Dettai Date: Wed, 18 Sep 2024 10:22:39 +0200 Subject: [PATCH] Increase the grace period on ECS --- distribution/ecs/quickwit/quickwit-indexer.tf | 3 +++ distribution/ecs/quickwit/service/ecs.tf | 2 ++ distribution/ecs/quickwit/service/variables.tf | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/distribution/ecs/quickwit/quickwit-indexer.tf b/distribution/ecs/quickwit/quickwit-indexer.tf index 441a1c7a8f8..ab3ca76a199 100644 --- a/distribution/ecs/quickwit/quickwit-indexer.tf +++ b/distribution/ecs/quickwit/quickwit-indexer.tf @@ -20,6 +20,9 @@ module "quickwit_indexer" { enable_cloudwatch_logging = var.enable_cloudwatch_logging service_config = var.quickwit_indexer quickwit_index_s3_prefix = local.quickwit_index_s3_prefix + # Longer termination grace period for indexers because their ingest services + # need to commit their WALs. Should be larger than the largest commit timeout. + stop_timeout = 120 } resource "aws_service_discovery_service" "indexer" { diff --git a/distribution/ecs/quickwit/service/ecs.tf b/distribution/ecs/quickwit/service/ecs.tf index 5b862271f77..03e299f4dcd 100644 --- a/distribution/ecs/quickwit/service/ecs.tf +++ b/distribution/ecs/quickwit/service/ecs.tf @@ -63,6 +63,8 @@ module "quickwit_service" { } ] + stopTimeout = var.stop_timeout + dependencies = var.sidecar_container_dependencies } }) diff --git a/distribution/ecs/quickwit/service/variables.tf b/distribution/ecs/quickwit/service/variables.tf index 09de61ff3ee..61404efd1bb 100644 --- a/distribution/ecs/quickwit/service/variables.tf +++ b/distribution/ecs/quickwit/service/variables.tf @@ -61,3 +61,8 @@ variable "task_execution_policy_arn" {} variable "quickwit_cpu_architecture" {} variable "module_id" {} + +variable "stop_timeout" { + # between 1s and 120s on Fargate, 30s is the ECS default + default = 30 +}