Skip to content

[#411] 학과 정보 서버 확인 전 제휴 API 호출되는 Race Condition 수정#414

Open
Hrepay wants to merge 2 commits intodevelopfrom
fix/#411
Open

[#411] 학과 정보 서버 확인 전 제휴 API 호출되는 Race Condition 수정#414
Hrepay wants to merge 2 commits intodevelopfrom
fix/#411

Conversation

@Hrepay
Copy link
Copy Markdown
Member

@Hrepay Hrepay commented Apr 3, 2026

🔗 연결된 이슈

Resolved #411

✨ 주요 작업사항

이번 PR의 핵심 변경사항을 알려주세요!

  • viewWillAppear에서 Realm(로컬 DB) 데이터 기반으로 제휴 API를 즉시 호출하던 로직을, 서버에서 학과 정보를 확인한 후 호출하도록 변경
  • viewDidLoad에서 중복 호출되던 fetchDepartmentAndUpdateButton() 제거

기존 문제

  • viewDidLoadfetchDepartmentAndUpdateButton() (비동기, 응답 대기중)
  • viewWillAppear → Realm에서 이전 세션의 학과 데이터를 읽고 바로 fetchMyPartnerships() 호출
  • 서버에는 학과 정보가 없는 상태에서 API가 호출되어 MISSING_USER_DEPARTMENT 에러 발생

수정 후

  • viewWillAppear에서 서버 학과 확인이 완료된 후에만 제휴 API를 호출하도록 순서 보장

🔍 리뷰어에게 (선택)

코드 리뷰 시 특별히 확인했으면 하는 부분이나, 의견을 묻고 싶은 내용을 적어주세요!

  • x

@Hrepay Hrepay self-assigned this Apr 3, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 메인 맵 화면에서 학과 정보 로드와 제휴 API 호출 간의 비동기 처리 순서를 보장하여 Race Condition을 수정하는 것을 목적으로 합니다. 기존에는 로컬 DB 데이터를 기반으로 API를 즉시 호출하여 서버 응답 오류가 발생할 가능성이 있었으나, 서버 확인 로직을 선행하도록 변경하여 안정성을 높였습니다.

Highlights

  • Race Condition 해결: viewWillAppear에서 서버의 학과 정보 확인이 완료된 후 제휴 API를 호출하도록 로직을 변경하여 데이터 불일치 문제를 해결했습니다.
  • 중복 호출 제거: viewDidLoad에서 불필요하게 호출되던 fetchDepartmentAndUpdateButton()을 제거하여 초기화 로직을 최적화했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


비동기 꼬인 실타래를 풀고서, 서버 응답 기다려 호출하네. 순서가 바로 서니 오류는 사라지고, 맵 위엔 평화가 찾아오네.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Code Review

이번 풀 리퀘스트에서는 MainMapViewController의 학과 정보 로드 및 UI 업데이트 로직을 개선하였습니다. viewDidLoad에서 수행하던 초기화 작업을 viewWillAppear로 옮기고, 서버 통신 완료 후 실행될 로직을 클로저 형태로 구현했습니다. 리뷰를 통해 fetchDepartmentAndUpdateButton 내부 로직과 중복되는 updateMyOnlyButtonTitle() 호출을 제거하여 코드를 최적화할 것을 제안했습니다.

@Hrepay Hrepay requested a review from wjdalswl April 3, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] MISSING_USER_DEPARTMENT 에러

1 participant