Skip to content

[REFACTOR] fetcher/rule/upgrader → publisher/upgrade.go 이동 (#385 Sub 3) #388

Description

@juhy0987

부모

부모 이슈: #385
의존: Sub 1

작업 범위

1. `internal/processor/fetcher/rule/upgrader.go` → `internal/publisher/upgrade.go` 이동

  • auto-upgrade (goquery → chromedp 자동 전환) 의 republish 로직 이동
  • `Upgrader` 구조체의 책임 분리:
    • Kafka publish 책임 → `publisher.PublishUpgrade(ctx, host, raws)` 로 흡수
    • upgrade 의사결정 로직 (`fetcher_rules` UPDATE, force_fetcher 토큰 발급 등) → fetcher 책임 유지 → `fetcher/rule/upgrader.go` 에 잔존 (Decider 명칭으로 rename 또는 분리)

2. 인터페이스 변경

```go
// fetcher 측 (의사결정만)
type UpgradeDecider interface {
DecideUpgrade(ctx, host) (raws []*RawContent, ok bool, err error)
}

// publisher 측 (republish 담당)
func (p *Publisher) PublishUpgrade(ctx, host, raws []*RawContent) error
```

3. 호출처 갱신

  • fetcher worker 가 upgrade 결정 후 publisher.PublishUpgrade 호출
  • 기존 `upgrader.PublishBatch` 직접 호출 제거

4. 테스트

  • upgrader 의 의사결정 로직은 fetcher 측 테스트 유지
  • publisher.PublishUpgrade 단위 테스트 신규

영향 / 위험

  • Medium — 책임 분리 + 인터페이스 변경
  • 라이브 영향 없음 (auto-upgrade 동작 동등)

완료 조건

  • Kafka publish 부분 → publisher
  • 의사결정 로직 → fetcher 잔존
  • 호출처 모두 publisher.PublishUpgrade 사용
  • race test 통과

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode refactoring

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions