Skip to content

[REFACTOR] Publisher 패키지 파일 분리 + 외부 facade 정의 (#385 Sub 1) #386

Description

@juhy0987

부모

부모 이슈: #385

작업 범위

1. 기존 `internal/publisher/publisher.go` 분리

  • chain 발행 로직 → `internal/publisher/chain.go` 로 이동 (구 `Publisher.Publish` / `PublishBatch`)
  • 외부 facade `Publisher` 구조체 정의 → `internal/publisher/publisher.go`
  • Guard / Lock / Gate wiring (`SetGate`, `SetIngestionLock`, `SetPipelineGuard`, `SetNormalizer`) → `internal/publisher/guard.go`

2. 외부 facade 시그니처

```go
type Publisher struct { ... }

func New(producer queue.Producer, resolver PriorityResolver, log *logger.Logger) *Publisher

// Sub 2~5 에서 채워질 메소드 (signature 만 미리 정의):
func (p *Publisher) PublishSeed(ctx, entry ScheduleEntry) error // Sub 2
func (p *Publisher) PublishChained(ctx, ...) error // 본 Sub — 기존 Publish 메소드 그대로
func (p *Publisher) PublishRetry(ctx, job, lastErr) error // Sub 4
func (p *Publisher) PublishUpgrade(ctx, host, raws) error // Sub 3
```

3. 외부 호출처 호환성

기존 `publisher.Publisher` 호출자 (parser_worker / search handler 등) — 본 Sub 에서 호출 시그니처 변경 없음. `Publish` → `PublishChained` rename 만.

4. 테스트

  • 기존 publisher 테스트가 그대로 통과해야 함 (rename 만)
  • 외부 facade Publisher 의 단위 테스트 (signature 검증)

영향 / 위험

  • Low — 파일 분리 + 메소드 rename. 동작 변경 없음.

완료 조건

  • `publisher.go` (facade) / `chain.go` (chained URL) / `guard.go` (guard wiring) 분리
  • `Publisher.Publish` → `PublisherChained` rename (호출처 동기 변경)
  • `go build` + 전체 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