From 78db8ab3ca4220d7df74530166a3edb54f584700 Mon Sep 17 00:00:00 2001 From: FinnIckler Date: Mon, 2 Sep 2024 15:35:20 +0200 Subject: [PATCH] allow worker to connect to redis and fix it from dying if it can't (#670) --- app/controllers/registration_controller.rb | 3 --- app/jobs/registration_processor.rb | 1 + config/environments/production.rb | 2 +- infra/worker/main.tf | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/registration_controller.rb b/app/controllers/registration_controller.rb index b4e8ba5b..409b5a8c 100644 --- a/app/controllers/registration_controller.rb +++ b/app/controllers/registration_controller.rb @@ -55,9 +55,6 @@ def create RegistrationProcessor.set(message_group_id: message_group_id, message_deduplication_id: message_deduplication_id).perform_later(step_data) - # Invalidate Cache - Rails.cache.delete("#{@user_id}-registrations-by-user") - render json: { status: 'accepted', message: 'Started Registration Process' }, status: :accepted end diff --git a/app/jobs/registration_processor.rb b/app/jobs/registration_processor.rb index a2070a11..5af03be2 100644 --- a/app/jobs/registration_processor.rb +++ b/app/jobs/registration_processor.rb @@ -15,6 +15,7 @@ def perform(message) message[:step_details][:guests], message[:created_at]) end + Rails.cache.delete("#{message[:user_id]}-registrations-by-user") end private diff --git a/config/environments/production.rb b/config/environments/production.rb index dc5ce16d..066ddffc 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -59,7 +59,7 @@ # Use a different cache store in production. config.cache_store = :redis_cache_store, { url: EnvConfig.REDIS_URL, - connect_timeout: 30, # Defaults to 20 seconds + connect_timeout: 5, # Defaults to 20 seconds read_timeout: 0.2, # Defaults to 1 second write_timeout: 0.2, # Defaults to 1 second reconnect_attempts: 1, # Defaults to 0 diff --git a/infra/worker/main.tf b/infra/worker/main.tf index cdae3330..ca2dbd7d 100644 --- a/infra/worker/main.tf +++ b/infra/worker/main.tf @@ -212,7 +212,7 @@ resource "aws_ecs_service" "this" { } network_configuration { - security_groups = [] + security_groups = [var.shared_resources.cluster_security.id] subnets = var.shared_resources.private_subnets }