Skip to content

fix: guard against blank FCM device tokens in sendMessageWithResult#2168

Merged
taejinn merged 2 commits intofix/2164-notification-duplicationfrom
copilot/sub-pr-2165-again
Mar 5, 2026
Merged

fix: guard against blank FCM device tokens in sendMessageWithResult#2168
taejinn merged 2 commits intofix/2164-notification-duplicationfrom
copilot/sub-pr-2165-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

sendMessageWithResult only checked targetDeviceToken == null, allowing empty or whitespace-only tokens to pass through and trigger unnecessary Firebase calls and warn-level log noise.

Change

Replace the null check with !StringUtils.hasText(targetDeviceToken) to early-return false for null, empty, and whitespace tokens:

// Before
if (targetDeviceToken == null) {
    return false;
}

// After
if (!StringUtils.hasText(targetDeviceToken)) {
    return false;
}

Uses org.springframework.util.StringUtils, already present in the project.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: taejinn <140797244+taejinn@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to address feedback on duplicate notification error fix fix: guard against blank FCM device tokens in sendMessageWithResult Mar 5, 2026
@taejinn taejinn marked this pull request as ready for review March 5, 2026 10:45
@taejinn taejinn merged commit 22195a2 into fix/2164-notification-duplication Mar 5, 2026
@taejinn taejinn deleted the copilot/sub-pr-2165-again branch March 5, 2026 10:46
taejinn added a commit that referenced this pull request Mar 10, 2026
* fix: 게시글 단위 키워드 알림 중복 발송 방지

* test: 키워드 알림 중복 방지 테스트 추가

* fix: 알림 상태 저장을 원자적 업서트로 변경

* fix: 키워드 이벤트 흐름의 지연 로딩 의존 제거

* fix: 키워드 구독 조회시 사용자 fetch join 적용

* fix: 업서트 쿼리에서 deprecated VALUES 함수 제거

* fix: 기발송 사용자 조회를 일괄 쿼리로 최적화

* fix: 키워드 알림 상태를 전송 성공 후 기록하도록 변경

* fix: FCM 전송 결과 메서드의 예외 처리 범위 확장

* test: 키워드 알림 전송 실패시 상태 미기록 테스트 추가

* fix: 알림 전송 메서드의 트랜잭션 경계 분리

* fix: 기발송 조회 대상을 매칭 사용자로 한정

* fix: 전송 성공 시에만 알림 레코드 저장

* fix: guard against blank FCM device tokens in sendMessageWithResult (#2168)

* Initial plan

* fix: use StringUtils.hasText to guard against blank FCM tokens

Co-authored-by: taejinn <140797244+taejinn@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: taejinn <140797244+taejinn@users.noreply.github.com>

* fix: 알림 전송 메서드가 호출자 트랜잭션에 참여하도록 수정

* fix: 배치 알림 전송 예외를 개별 처리하도록 수정

* fix: 키워드 알림 조회와 푸시 전송 흐름을 개선

* fix: 전송 결과 알림은 성공 시에만 저장하도록 수정

* fix: 발송 후 알림 저장을 별도 트랜잭션으로 분리

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants