From 29ba325b5d4918910cef4d4bb9bbc945a97f9f5d Mon Sep 17 00:00:00 2001 From: interu Date: Wed, 6 Mar 2024 17:31:21 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20RDS=E3=81=8CMultiAZ=E3=81=AE=E9=9A=9B?= =?UTF-8?q?=E3=81=ABfailover=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB?= =?UTF-8?q?=E3=82=B3=E3=83=8D=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=97?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E3=82=92=E7=A0=B4=E6=A3=84=E3=81=97=E3=81=A6?= =?UTF-8?q?=E5=86=8D=E6=8E=A5=E7=B6=9A=E3=81=97=E7=9B=B4=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/sg_fargate_rails/healthcheck.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sg_fargate_rails/healthcheck.rb b/lib/sg_fargate_rails/healthcheck.rb index 767e295..f41b5d3 100644 --- a/lib/sg_fargate_rails/healthcheck.rb +++ b/lib/sg_fargate_rails/healthcheck.rb @@ -35,6 +35,8 @@ def database_accessible? !!ActiveRecord::Base.connection.tables.min rescue StandardError => e Rails.logger.error "[SgFargateRails] Failed to connect database. #{e.inspect}" + # NOTE: RDSがMultiAZの際にfailoverした場合にコネクションプールを破棄して再接続し直す + ActiveRecord::Base.clear_all_connections! false end end