Skip to content

[#687] UserTimeZone 동기화 요청을 중복 제한한다#689

Merged
opficdev merged 3 commits into
developfrom
fix/#687-usertimezone
Jul 4, 2026
Merged

[#687] UserTimeZone 동기화 요청을 중복 제한한다#689
opficdev merged 3 commits into
developfrom
fix/#687-usertimezone

Conversation

@opficdev

@opficdev opficdev commented Jul 3, 2026

Copy link
Copy Markdown
Owner

🔗 연관된 이슈

🎯 의도

  • 앱 실행, 인증 상태 방출, foreground 복귀 흐름에서 User timeZone 동기화 요청이 겹칠 수 있어 같은 사용자와 같은 timeZone 조합의 반복 저장을 방지

📝 작업 내용

📌 요약

  • launch 시점의 직접 timeZone 동기화 요청 제거
  • UserTimeZoneSyncHandler의 로그인 상태 중복 방출 필터링 추가
  • 같은 (uid, timeZoneIdentifier) 조합의 완료/진행 중 중복 저장 방지 처리
  • 동시 foreground 요청과 연속 로그인 상태 방출 테스트 추가

🔍 상세

  • didFinishLaunchingWithOptions에서 .didRequestUserTimeZoneSync 직접 post 제거
  • observeSignedIn()removeDuplicates() 적용
  • SyncKeyHashable로 변경하고 syncingKeys로 진행 중인 같은 key 중복 요청 차단
  • 로그아웃 상태 전이 시 lastSyncedKeysyncingKeys 초기화
  • updateUserTimeZone() 성공 후에만 lastSyncedKey 갱신
  • 같은 로그인 상태 연속 방출, 저장 중 foreground 요청, 사용자/timeZone 변경, 실패 후 재시도 케이스 테스트 보강

📸 영상 / 이미지 (Optional)

@opficdev opficdev self-assigned this Jul 3, 2026
@opficdev opficdev changed the title [#687] UserTimeZone 동기화 요청을 FCM token 흐름처럼 중복 제한한다 [#687] UserTimeZone 동기화 요청을 중복 제한한다 Jul 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors UserTimeZoneSyncHandler to prevent duplicate timezone synchronization requests by introducing a syncingKeys set and adding .removeDuplicates() to the sign-in observer. However, the review highlights two critical issues: first, .removeDuplicates() on the sign-in publisher will block synchronization when switching users directly without logging out; second, accessing mutable state like syncingKeys and lastSyncedKey across multiple threads without synchronization introduces data race risks, which should be resolved using a lock or serial queue rather than @MainActor isolation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Application/App/Sources/App/Handler/UserTimeZoneSyncHandler.swift
Comment thread Application/App/Sources/App/Handler/UserTimeZoneSyncHandler.swift
@opficdev opficdev force-pushed the fix/#687-usertimezone branch from 24e522e to 0f90c88 Compare July 3, 2026 16:59
@opficdev opficdev merged commit e02793b into develop Jul 4, 2026
6 checks passed
@opficdev opficdev deleted the fix/#687-usertimezone branch July 4, 2026 03:10
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.

UserTimeZone 동기화 요청을 중복 제한한다

1 participant