Skip to content

Commit 3e81b1b

Browse files
committed
refactor: 주석 정리
1 parent e326ec6 commit 3e81b1b

2 files changed

Lines changed: 13 additions & 30 deletions

File tree

src/main/java/com/back/web7_9_codecrete_be/domain/artists/service/spotifyService/SpotifyRateLimitHandler.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ public <T> T callWithRateLimitRetry(java.util.function.Supplier<T> supplier, Str
226226
throw new RuntimeException(context + ": rate limit retry exhausted");
227227
}
228228

229-
/**
230-
* 401 Unauthorized 에러인지 확인
231-
*/
229+
// 401 에러인지 확인
232230
private boolean is401Error(Throwable e) {
233231
Throwable current = e;
234232
while (current != null) {

src/main/java/com/back/web7_9_codecrete_be/global/spotify/SpotifyClient.java

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
import java.util.concurrent.locks.ReentrantLock;
1111

12-
/**
13-
* Spotify AccessToken 중앙 관리 클래스
14-
*
15-
* - 토큰 만료 시간 관리 (1시간 유효)
16-
* - 만료 전 자동 재발급 (5분 여유)
17-
* - 401 에러 발생 시 자동 재발급 및 재요청 지원
18-
*/
12+
// Spotify AccessToken 중앙 관리 클래스
13+
14+
// 토큰 만료 시간 관리 (1시간 유효)
15+
// 만료 전 자동 재발급 (5분 여유)
16+
// 401 에러 발생 시 자동 재발급 및 재요청 지원
17+
1918
@Slf4j
2019
@Component
2120
@RequiredArgsConstructor
@@ -32,10 +31,7 @@ public class SpotifyClient {
3231
private static final long TOKEN_BUFFER_SECONDS = 300;
3332
private static final long TOKEN_BUFFER_MS = TOKEN_BUFFER_SECONDS * 1000;
3433

35-
/**
36-
* AccessToken 발급 (내부 메서드)
37-
* 동시성 제어를 통해 중복 발급 방지
38-
*/
34+
// AccessToken 발급
3935
private String refreshAccessToken() {
4036
tokenLock.lock();
4137
try {
@@ -72,10 +68,7 @@ private String refreshAccessToken() {
7268
}
7369
}
7470

75-
/**
76-
* AccessToken 조회 (만료 체크 포함)
77-
* 만료되었거나 곧 만료될 경우 자동 재발급
78-
*/
71+
// AccessToken 조회 (만료 체크 포함) - 만료되었거나 곧 만료될 경우 자동 재발급
7972
public String getAccessToken() {
8073
long now = System.currentTimeMillis();
8174

@@ -87,19 +80,13 @@ public String getAccessToken() {
8780
return cachedAccessToken;
8881
}
8982

90-
/**
91-
* 인증된 SpotifyApi 반환
92-
* 토큰이 없거나 만료된 경우 자동으로 재발급
93-
*/
83+
// 인증된 SpotifyApi 반환 - 토큰이 없거나 만료된 경우 자동으로 재발급
9484
public SpotifyApi getAuthorizedApi() {
9585
getAccessToken(); // 만료 체크 및 필요시 재발급
9686
return spotifyApi;
9787
}
98-
99-
/**
100-
* 401 에러 발생 시 토큰 강제 재발급
101-
* 이 메서드를 호출한 후 API를 재요청해야 함
102-
*/
88+
89+
// 401 에러 발생 시 토큰 강제 재발급 (SpotifyRateLimitHandler에서 자동 호출)
10390
public void forceRefreshToken() {
10491
log.warn("401 에러 감지 - Spotify AccessToken 강제 재발급");
10592
tokenLock.lock();
@@ -113,9 +100,7 @@ public void forceRefreshToken() {
113100
}
114101
}
115102

116-
/**
117-
* 토큰 만료 여부 확인
118-
*/
103+
// 토큰 만료 여부 확인
119104
public boolean isTokenExpired() {
120105
return cachedAccessToken == null || System.currentTimeMillis() >= tokenExpiresAt;
121106
}

0 commit comments

Comments
 (0)