feat: 푸시 토큰 - 한 사람이 여러개의 디바이스로 로그인 해도 모든 푸시 토큰이 기록되어 있어서 모든 디바이스에 푸시가 가도록 수정
This commit is contained in:
@@ -14,7 +14,7 @@ import org.springframework.scheduling.annotation.Async
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class FcmService {
|
||||
class FcmService(private val pushTokenService: PushTokenService) {
|
||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||
|
||||
@Async
|
||||
@@ -100,7 +100,8 @@ class FcmService {
|
||||
|
||||
if (exception?.messagingErrorCode == MessagingErrorCode.UNREGISTERED) {
|
||||
logger.error("[FCM] ❌ UNREGISTERED → $token")
|
||||
// 필요 시 DB에서 삭제
|
||||
// DB에서 삭제
|
||||
pushTokenService.unregisterInvalidToken(token)
|
||||
} else {
|
||||
logger.error("[FCM] ❌ 실패: $token / ${exception?.messagingErrorCode}")
|
||||
failedTokens.add(token)
|
||||
@@ -148,6 +149,8 @@ class FcmService {
|
||||
// "registration-token-not-registered" 예외 코드 확인
|
||||
if (e.messagingErrorCode == MessagingErrorCode.UNREGISTERED) {
|
||||
logger.error("[FCM] ❌ 실패: 토큰이 등록되지 않음 (등록 해제됨) → 재시도 안함")
|
||||
// DB에서 삭제
|
||||
pushTokenService.unregisterInvalidToken(token)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user