Skip to content

fix: add error handling for prodive non-blocking while scheduler data fetching#279

Merged
yuchem2 merged 2 commits into
developfrom
FIENMEE-656
Oct 1, 2025
Merged

fix: add error handling for prodive non-blocking while scheduler data fetching#279
yuchem2 merged 2 commits into
developfrom
FIENMEE-656

Conversation

@yuchem2

@yuchem2 yuchem2 commented Sep 26, 2025

Copy link
Copy Markdown
Member

공공데이터를 활용할 때 일부 필드가 비어있는 데이터를 만날 시 전체 데이터 등록이 되지 않는 문제를 해결합니다.

@notion-workspace

Copy link
Copy Markdown

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yuchem2, 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)를 활용하여 데이터를 가져오고 저장하는 과정의 안정성과 견고성을 향상시키는 데 중점을 둡니다. 외부 API에서 제공되는 데이터의 일부 필드가 비어있거나 잘못된 형식일 경우에도 전체 데이터 등록이 실패하지 않도록 오류 처리 메커니즘을 도입했습니다. 또한, API 요청의 안정성을 높이기 위해 요청 간 지연 시간을 조정하고, 데이터 수량 정보가 누락되었을 때 발생할 수 있는 문제를 방지하는 로직을 추가했습니다.

Highlights

  • 데이터 처리 안정성 강화: 서울시 공공데이터 및 투어 API 데이터 처리 로직에 try-catch 블록을 추가하여, 개별 데이터 항목에 필드 누락이나 잘못된 정보가 있더라도 전체 데이터 등록 프로세스가 중단되지 않고 해당 항목만 건너뛰도록 개선했습니다.
  • API 요청 간격 조정 및 안정성 확보: 서울시 공공데이터 API 요청 간 지연 시간을 500ms에서 1000ms로 늘려 동시 요청으로 인한 문제를 방지하고, list_total_count가 없을 경우 데이터 가져오기 루프를 중단하는 로직을 추가하여 무한 루프나 오류를 예방했습니다.
  • 데이터 유효성 검사 및 정리: 투어 API의 makeDescription 함수에 eventDescription에 대한 null 체크를 추가하고, targetAudience 필드 처리 로직을 개선하여 데이터 유효성을 높였습니다.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@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

이 PR은 공공 데이터의 일부 필드가 비어있을 때 전체 데이터 등록이 실패하는 문제를 해결하기 위한 것으로 보입니다. try-catch 블록을 추가하여 문제가 있는 데이터 항목을 건너뛰도록 수정한 것은 좋은 접근 방식입니다. 다만, 현재 구현에서는 오류가 발생한 데이터가 무엇인지 추적하기 어렵습니다. 두 군데에 오류 로깅을 추가하여 추후 디버깅을 용이하게 하도록 제안하는 코멘트를 남겼습니다. 옵셔널 체이닝 사용이나 console.log 제거 등 다른 변경 사항들은 코드 품질을 향상시키는 좋은 개선입니다.

Comment thread apps/server/src/services/seoul/databatch.ts Outdated
Comment thread apps/server/src/services/tourApi/databatch.ts Outdated
ninaxlee
ninaxlee previously approved these changes Sep 28, 2025
const result = await getSeoulData(st, end)
await saveSeoulData(result.culturalEventInfo.row, today)
await new Promise(resolve => setTimeout(resolve, 500)) // 각 요청마다 500ms 간격 추가 (동시 요청 불가능)
await new Promise(resolve => setTimeout(resolve, 1000)) // 각 요청마다 1000ms 간격 추가 (동시 요청 불가능)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

간격이 늘어난 이유가 있을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

간격이 짧아서 요청이 거절되는 경우가 있더라고요. 그래서 요청 간격을 늘렸습니다.

@yuchem2 yuchem2 merged commit 70dca9c into develop Oct 1, 2025
2 checks passed
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.

3 participants