fix: add error handling for prodive non-blocking while scheduler data fetching#279
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
이 PR은 공공 데이터의 일부 필드가 비어있을 때 전체 데이터 등록이 실패하는 문제를 해결하기 위한 것으로 보입니다. try-catch 블록을 추가하여 문제가 있는 데이터 항목을 건너뛰도록 수정한 것은 좋은 접근 방식입니다. 다만, 현재 구현에서는 오류가 발생한 데이터가 무엇인지 추적하기 어렵습니다. 두 군데에 오류 로깅을 추가하여 추후 디버깅을 용이하게 하도록 제안하는 코멘트를 남겼습니다. 옵셔널 체이닝 사용이나 console.log 제거 등 다른 변경 사항들은 코드 품질을 향상시키는 좋은 개선입니다.
| 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 간격 추가 (동시 요청 불가능) |
There was a problem hiding this comment.
간격이 짧아서 요청이 거절되는 경우가 있더라고요. 그래서 요청 간격을 늘렸습니다.
공공데이터를 활용할 때 일부 필드가 비어있는 데이터를 만날 시 전체 데이터 등록이 되지 않는 문제를 해결합니다.