From 33c8708a1ac7df363bf2bd74ab8fa2ed7168379c Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 8 Sep 2023 17:01:02 +0200 Subject: [PATCH] Change `GET /api/v1/directory` to use database replica rather than primary (#26856) --- app/controllers/api/v1/directories_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/directories_controller.rb b/app/controllers/api/v1/directories_controller.rb index 110943550..35c504a7f 100644 --- a/app/controllers/api/v1/directories_controller.rb +++ b/app/controllers/api/v1/directories_controller.rb @@ -16,7 +16,9 @@ class Api::V1::DirectoriesController < Api::BaseController end def set_accounts - @accounts = accounts_scope.offset(params[:offset]).limit(limit_param(DEFAULT_ACCOUNTS_LIMIT)) + with_read_replica do + @accounts = accounts_scope.offset(params[:offset]).limit(limit_param(DEFAULT_ACCOUNTS_LIMIT)) + end end def accounts_scope