Api::V1::FacilityTypesController#index (avg 13606ms, max 13606ms)
Summary: Api::V1::FacilityTypesController#index latency (avg 13606ms)
결과#
RCA 의 "즉시 조치 (Critical)" 두 항목을 tesla repo 에 구현하고 PR 을 생성 완료. Blind validator 가 first-attempt 로 APPROVE. Empty ES 결과에서 permission_joins 를 건너뛰고 facilities_count 를 batch preload 하여 3-75s 응답 시간이 대폭 감소할 것으로 예상.
Pull Requests#
| Repo | PR | Branch |
|---|---|---|
| tesla | https://cupix.visualstudio.com/DefaultCollection/tesla/_git/tesla/pullrequest/88698 | feature/TSLA-13513 |
변경 내용#
- tesla
app/repositories/base_repository.rb:BaseRepository#search가_search후 records 가 empty 이면 permission_joins 를 건너뛰고 emptySearchResult를 즉시 반환. 모든 상속 repository 에 적용되지만 semantics preserving. - tesla
app/repositories/facility_type_repository.rb:FacilityTypeRepository#searchoverride 추가 +preload_facilities_count!private helper. Sub-type 은 단일 GROUP BY, main-type 은 subtree_ids 를 모아 하나의 GROUP BY 후 in-memory 합산. 계산된 count 를record[:facilities_count]=로 assign 하여 model 의 short-circuit 을 활용, per-row SQL COUNT 제거.
총 2 파일, 67줄 추가. Rubocop / rspec pre-commit hook 통과.
Cleanup#
bash
cd $REPOS_DIR/tesla
git worktree remove /home/ec2-user/error-sweeper/.worktrees/57663a4e-9a14-42c2-bf65-937fce71a81d/tesla