Skip to content

[Artist] Redis 도입 및 SpotifyService 리팩토링#301

Merged
Creamcheesepie merged 7 commits into
mainfrom
feat/#293
Jan 7, 2026
Merged

[Artist] Redis 도입 및 SpotifyService 리팩토링#301
Creamcheesepie merged 7 commits into
mainfrom
feat/#293

Conversation

@ys0221
Copy link
Copy Markdown
Collaborator

@ys0221 ys0221 commented Jan 6, 2026

🔗 관련 이슈

관련된 이슈 번호를 연결해주세요.
Close #이슈번호 를 쓰면 PR merge 시 자동으로 close 됩니다.

🚀 PR 개요

이 PR이 어떤 변경을 포함하고 있는지 간단히 설명해주세요.

아티스트 상세 조회 요청은 1회당 Spotify API를 최소 3회(아티스트 기본 정보, Top Tracks, 앨범 목록) 호출하는 구조로 되어 있습니다. 이로 인해 동일 아티스트를 반복해서 조회할 경우 Spotify API Rate Limit(429 오류)가 발생할 수 있습니다. 따라서 이를 개선하기 위해 Redis 에 Spotify API 호출 응답(artistName, profileImageUrl, popularity, topTracks, albums, totalAlbums) 을 저장하여 Spotify API 호출 결과를 일정 시간 동안 재사용하도록 변경하였습니다.

또한 SpotifyService 의 코드 라인 수가 너무 많아져서 하나의 Spotify 패키지 안에 여러 파일로 분류하는 리팩토링 작업을 진행하였습니다.

📌 변경 사항

주요 변경 내용을 체크리스트 형태로 정리해주세요.

  • 기능 추가
  • 버그 수정
  • 리팩터링
  • 문서 업데이트
  • 테스트 추가/수정

🧪 테스트 방법

변경된 내용을 어떻게 테스트했는지 구체적으로 적어주세요.

테스트 코드를 작성하였습니다.

📸 스크린샷 (선택)

UI 변경 또는 시각적으로 확인할 수 있는 변경이 있다면 첨부해주세요.

⚠️ 참고 사항

리뷰어가 알아야 할 사항이 있다면 자유롭게 작성해주세요.

리팩토링의 경우 refactor/#300 브랜치에서 작업하여 PR 을 올렸는데, 해당 브랜치를 pull 해서 받은 후 테스트 코드 작업을 진행하게 돼서 PR 이 좀 꼬였습니다... 그래서 refactor/#300 브랜치는 닫고 이 브랜치에서 리팩토링까지 올렸습니다.

@ys0221 ys0221 self-assigned this Jan 6, 2026
@ys0221 ys0221 added the Feature label Jan 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 6, 2026

Test Results

58 tests  +25   58 ✅ +25   10s ⏱️ +6s
 9 suites + 3    0 💤 ± 0 
 9 files   + 3    0 ❌ ± 0 

Results for commit 796cf4a. ± Comparison against base commit 4634e0b.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 6, 2026

⭐ JaCoCo Coverage

Line Coverage: 7.58%

📄 Coverage Details

Overall Line Coverage: 7.57% (540 covered / 7130 lines)

Package Summary (lowest first)
Package Line % Covered Missed
com/back/web7_9_codecrete_be/domain/plans/controller 0.00% 0 63
com/back/web7_9_codecrete_be/domain/chats/entity 0.00% 0 4
com/back/web7_9_codecrete_be/domain/serverTime/entity 0.00% 0 9
com/back/web7_9_codecrete_be/domain/auth/entity 0.00% 0 0
com/back/web7_9_codecrete_be/domain/auth/service 0.00% 0 150
com/back/web7_9_codecrete_be/domain/artists/service/spotify/related/model 0.00% 0 5
com/back/web7_9_codecrete_be/domain/auth/controller 0.00% 0 24
com/back/web7_9_codecrete_be/domain/community/comment/controller 0.00% 0 10
com/back/web7_9_codecrete_be/domain/community/comment/entity 0.00% 0 12
com/back/web7_9_codecrete_be/domain/serverTime/controller 0.00% 0 3
com/back/web7_9_codecrete_be/domain/location/controller 0.00% 0 73
com/back/web7_9_codecrete_be/domain/location/entity 0.00% 0 15
com/back/web7_9_codecrete_be/global/scheduler 0.00% 0 11
com/back/web7_9_codecrete_be/global/initData 0.00% 0 59
com/back/web7_9_codecrete_be/domain/email/entity 0.00% 0 6
com/back/web7_9_codecrete_be/domain/community/comment/service 0.00% 0 24
com/back/web7_9_codecrete_be/domain/artists/controller 0.00% 0 37
com/back/web7_9_codecrete_be/domain/community/post/controller 0.00% 0 59
com/back/web7_9_codecrete_be/domain/plans/service 0.20% 1 492
com/back/web7_9_codecrete_be/domain/artists/service/artistEnrichService 0.29% 4 1376
com/back/web7_9_codecrete_be/domain/community/post/service 0.39% 1 258
com/back/web7_9_codecrete_be/domain/artists/service 0.58% 4 686
com/back/web7_9_codecrete_be/global/wikidata 0.76% 5 652
com/back/web7_9_codecrete_be/domain/artists/service/spotify/related 0.87% 1 114
com/back/web7_9_codecrete_be/global/musicbrainz 0.99% 5 501
com/back/web7_9_codecrete_be/global/maniadb 1.22% 1 81
com/back/web7_9_codecrete_be/domain/artists/service/spotify/application 1.23% 1 80
com/back/web7_9_codecrete_be/domain/email/service 1.61% 1 61
com/back/web7_9_codecrete_be/domain/chats/service 1.68% 2 117
com/back/web7_9_codecrete_be/global/flo 1.85% 1 53
com/back/web7_9_codecrete_be/domain/concerts/controller 2.27% 1 43
com/back/web7_9_codecrete_be/domain/artists/service/spotify/genre 2.78% 1 35
com/back/web7_9_codecrete_be/domain/concerts/repository 3.45% 1 28
com/back/web7_9_codecrete_be/global/storage 3.57% 2 54
com/back/web7_9_codecrete_be/global/websocket 4.65% 4 82
com/back/web7_9_codecrete_be/domain/serverTime/service 6.25% 3 45
com/back/web7_9_codecrete_be/domain/artists/entity 7.89% 6 70
com/back/web7_9_codecrete_be/global/redis 8.33% 2 22
com/back/web7_9_codecrete_be/global/rq 9.80% 5 46
com/back/web7_9_codecrete_be/domain/chats/controller 10.00% 2 18
com/back/web7_9_codecrete_be/domain/concerts/service 13.89% 81 502
com/back/web7_9_codecrete_be/domain/community/post/entity 14.13% 13 79
com/back/web7_9_codecrete_be/domain/users/util 14.29% 1 6
com/back/web7_9_codecrete_be/domain/plans/entity 18.10% 21 95
com/back/web7_9_codecrete_be/domain/location/service 29.50% 59 141
com/back/web7_9_codecrete_be/domain/users/service 31.53% 35 76
com/back/web7_9_codecrete_be/global/security 37.38% 40 67
com/back/web7_9_codecrete_be/domain/concerts/entity 37.63% 35 58
com/back/web7_9_codecrete_be/domain/artists/service/spotify/rate_limit 38.57% 27 43
com/back/web7_9_codecrete_be/domain/users/controller 51.61% 16 15
com/back/web7_9_codecrete_be/domain/users/entity 64.81% 35 19
com/back/web7_9_codecrete_be/global/rsData 81.82% 9 2
com/back/web7_9_codecrete_be/global/spotify 87.50% 35 5
com/back/web7_9_codecrete_be/domain/artists/service/spotify/cache 93.55% 58 4
com/back/web7_9_codecrete_be/global/doc 100.00% 17 0
com/back/web7_9_codecrete_be/global/aspect 100.00% 4 0
Lowest Covered Classes (Top 20)
Class Line % Covered Missed
com.back.web7_9_codecrete_be.domain.artists.service.artistEnrichService.EnrichStepExecutor 0.00% 0 183
com.back.web7_9_codecrete_be.domain.artists.service.ArtistService 0.00% 0 99
com.back.web7_9_codecrete_be.domain.auth.service.AuthService 0.00% 0 88
com.back.web7_9_codecrete_be.domain.plans.controller.PlanController 0.00% 0 63
com.back.web7_9_codecrete_be.domain.location.controller.KakaoApiController 0.00% 0 60
com.back.web7_9_codecrete_be.global.initData.BaseInitData 0.00% 0 59
com.back.web7_9_codecrete_be.domain.plans.entity.Schedule 0.00% 0 54
com.back.web7_9_codecrete_be.domain.community.post.service.MyCommunityService 0.00% 0 47
com.back.web7_9_codecrete_be.domain.community.post.service.PostService 0.00% 0 44
com.back.web7_9_codecrete_be.domain.location.service.PlanCostTimeService 0.00% 0 43
com.back.web7_9_codecrete_be.domain.community.post.service.JoinPostService 0.00% 0 41
com.back.web7_9_codecrete_be.domain.artists.entity.Artist 0.00% 0 40
com.back.web7_9_codecrete_be.domain.chats.service.ChatPolicyService 0.00% 0 38
com.back.web7_9_codecrete_be.global.security.JwtTokenProvider 0.00% 0 37
com.back.web7_9_codecrete_be.domain.location.service.LocationService 0.00% 0 30
com.back.web7_9_codecrete_be.domain.plans.entity.Plan 0.00% 0 30
com.back.web7_9_codecrete_be.domain.artists.controller.ArtistsController 0.00% 0 30
com.back.web7_9_codecrete_be.domain.auth.service.TokenService 0.00% 0 26
com.back.web7_9_codecrete_be.domain.auth.controller.AuthController 0.00% 0 24
com.back.web7_9_codecrete_be.domain.community.post.entity.Post 0.00% 0 24
Changed Classes (from this PR)
Source (PR) Class Prefix Line % Covered Missed
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/ArtistService.java com.back.web7_9_codecrete_be.domain.artists.service.ArtistService 0.00% 0 99
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/genre/CategoryConfig.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.genre.CategoryConfig 0.00% 0 5
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/related/model/ScoredArtist.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.related.model.ScoredArtist 0.00% 0 5
src/main/java/com/back/web7_9_codecrete_be/domain/artists/dto/response/SpotifyArtistDetailCache.java com.back.web7_9_codecrete_be.domain.artists.dto.response.SpotifyArtistDetailCache 0.00% 0 0
src/main/java/com/back/web7_9_codecrete_be/domain/artists/repository/ArtistRepository.java com.back.web7_9_codecrete_be.domain.artists.repository.ArtistRepository 0.00% 0 0
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/dto/ArtistData.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.dto.ArtistData 0.00% 0 0
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotifyService/SpotifyRateLimitHandler.java com.back.web7_9_codecrete_be.domain.artists.service.spotifyService.SpotifyRateLimitHandler 0.00% 0 0
src/main/java/com/back/web7_9_codecrete_be/domain/community/post/dto/response/ReviewPostResponse.java com.back.web7_9_codecrete_be.domain.community.post.dto.response.ReviewPostResponse 0.00% 0 0
src/main/java/com/back/web7_9_codecrete_be/global/config/RedisConfig.java com.back.web7_9_codecrete_be.global.config.RedisConfig 0.00% 0 0
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/SpotifyService.java com.back.web7_9_codecrete_be.domain.artists.service.SpotifyService 0.69% 4 579
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/related/RelatedArtistService.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.related.RelatedArtistService 0.87% 1 114
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/application/SpotifyDetailService.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.application.SpotifyDetailService 1.23% 1 80
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/genre/GenreNormalizationService.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.genre.GenreNormalizationService 3.23% 1 30
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/rate_limit/SimpleRateLimiter.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.rate_limit.SimpleRateLimiter 30.77% 4 9
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/rate_limit/SpotifyRateLimitHandler.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.rate_limit.SpotifyRateLimitHandler 40.35% 23 34
src/main/java/com/back/web7_9_codecrete_be/global/spotify/SpotifyClient.java com.back.web7_9_codecrete_be.global.spotify.SpotifyClient 85.71% 30 5
src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotify/cache/SpotifyCacheService.java com.back.web7_9_codecrete_be.domain.artists.service.spotify.cache.SpotifyCacheService 93.55% 58 4

🔗 Full HTML report: See artifact jacoco-full-html on this run → https://github.com/prgrms-web-devcourse-final-project/WEB7_9_codecrete_BE/actions/runs/20766616843

@ys0221 ys0221 changed the title [Artist] Redis 도입 [Artist] Redis 도입 및 SpotifyService 리팩토링 Jan 6, 2026
Copy link
Copy Markdown
Collaborator

@Creamcheesepie Creamcheesepie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 분량이 ㅎㄷㄷ.... 수고하셨습니다!

Copy link
Copy Markdown
Collaborator

@tobbot16 tobbot16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

Copy link
Copy Markdown
Collaborator

@larama-C larama-C left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리팩토링으로 좀 더 깔끔해진 것 같습니다!

Copy link
Copy Markdown
Collaborator

@heygeeji heygeeji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

@Creamcheesepie Creamcheesepie merged commit 7546951 into main Jan 7, 2026
2 checks passed
@Creamcheesepie Creamcheesepie deleted the feat/#293 branch January 7, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Artist] SpotifyService 리팩토링 [Artist] Redis 도입

5 participants