-
Notifications
You must be signed in to change notification settings - Fork 0
RSS 기반 포스팅 업데이트 및 스케쥴러 구현 #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces RSS feed parsing, automatic posting creation, and periodic synchronization via a scheduler. It also includes updates to configuration handling and database connection parameters for consistency.
- Added RSS feed parsing using gofeed and posting creation logic.
- Implemented a scheduler using robfig/cron for periodic RSS synchronization.
- Updated configuration and database connection to use the standardized "DB" naming.
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
internal/testutils/db.go | Updated database connection parameter from "Db" to "DB". |
internal/schemasupport/posting_tags.go | Added helper function to create PostingTags from a string slice. |
internal/scheduler/scheduler.go | Implemented scheduler setup and RSS synchronization job. |
internal/rss/rss_parser_test.go | Added unit tests for syncing RSS feeds with mock server. |
internal/rss/rss_parser.go | Implemented RSS items fetching, processing, and posting creation. |
internal/http/router/router.go | Added new RSS sync endpoints. |
internal/http/handler/rsshandler.go | Implemented HTTP handlers for syncing RSS feeds. |
internal/database/database.go | Updated database connection parameter from "Db" to "DB". |
config/config.go | Updated configuration structs and environment variable handling. |
cmd/main.go | Integrated the scheduler startup/shutdown in the main app. |
CLAUDE.md | Added documentation for using Claude Code in the repo. |
Files not reviewed (1)
- go.mod: Language not supported
report: Run #73
❌ Some tests failed!
|
report: Run #73
❌ Some tests failed!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 로컬에서는 내가 따로 테스트 돌려도 성공하는데, 왜 액션에서 실패하는 이유 한번 따로 파악해봐야할듯....
바이브코딩이슈인지 먼가 내가 초기에 액션 설정이나 머 잘못한거 있는지 너무 오랜만에 이거 코드 보는거라 파악 필요....
for _, company := range companies { | ||
if company.RssURL != nil { | ||
count, err := SyncCompanyRSSFeed(ctx, client, company.ID) | ||
if err != nil { | ||
log.Printf("Failed to sync RSS feed for company %s: %v", company.Name, err) | ||
continue | ||
} | ||
totalCount += count | ||
log.Printf("Synced %d new postings for %s", count, company.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘 모르고 남기는 걸수도 있음!!
rss 피드 수집하는거 순차적으로 도는 걸로 이해했는데
나중에 여기 고루틴 써볼 수 있을듯?!
log.Println("Starting RSS feed sync...") | ||
|
||
// Create a context with timeout | ||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
타임아웃 👍
c := cron.New(cron.WithSeconds()) | ||
return &Scheduler{ | ||
client: client, | ||
cron: c, | ||
config: config, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c := cron.New(cron.WithSeconds()) | |
return &Scheduler{ | |
client: client, | |
cron: c, | |
config: config, | |
} | |
c := cron.New( | |
cron.WithSeconds(), | |
cron.WithLogger(cron.VerbosePrintfLogger(log.Default())), // 상세히 찍히는 로그! | |
cron.WithChain( | |
cron.Recover(cron.DefaultLogger), // panic 복구 | |
), | |
) | |
return &Scheduler{ | |
client: client, | |
cron: c, | |
config: config, | |
} |
찾아보니 요래 미들웨어형식으로 추가해줄 수 있다고 하네
withChain은 Job 돌아가다가 Panic이 발생해도 스케줄러는 계속 돌아가도록 하는 넘!
} | ||
|
||
// Default to every hour if not specified | ||
rssSyncCron := "0 0 * * * *" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수화...?!
클로드 코드로 일단 그냥 바이브코딩 해봄
아래 내용도 클로드 시켜서 만든 PR 요약
ps. 난 그냥 어떤거 해야하는지 시키고, 대충봐도 보이는 잘못된부분들 좀 짚어주면서 만들라 시키고, 버그수정도 이친구보고 테스트코드 만들라하고 이친구가 자동으로 테스트 실행해보면서 거기 나오는 로그 분석해서 맞춰서 코드 수정하고 그냥 지 혼자 다함. 난 에디터에서 직접 코드 수정한거 이번 PR에서는 하나도 없게 한번 해봄.
필요한 dependency 설치 커맨드도, 테스트코드 실행도, 깃 커밋도 전부 다 클로드가 함, 난 claude code 내에서 시킨것만있음 진짜로
따라서 이거 나중에 좀 시간날때 나도 다시한번 잘 만들어진거 맞나 리뷰 나도 해봐야함ㅎㅎ
ps2. 총 소요시간 + api 요금
느낀바 : 이번엔 그냥 무지성 해줘 바이브코딩에 약간 너무 이상한거 짚어주기정도였는데, 좀 내가 작업하면서 같이 사용하고 범위 특정해주고, 익숙해지면 좀 더 싸게도 처리할 수 있을듯. 소요 시간은 중간중간 더 자세히 좀 리뷰해주고 하는 시간들 들여보고 해야해서 불확실
RSS 피드 수집 및 포스팅 자동화 기능 추가
주요 변경사항
구현 세부 내용
internal/rss
: RSS 피드 파싱 및 포스팅 생성 로직 구현internal/scheduler
: 주기적인 RSS 피드 동기화를 위한 스케줄러 구현internal/http/handler/rsshandler.go
: RSS 관련 API 핸들러 구현테스트
기타 개선사항
Db
->DB
)