Skip to content

Worker with embeded WorkerDefaults does not implement Worker interface #562

@taras-turchenko-moc

Description

@taras-turchenko-moc

Hi guys. I have an issue with river.AddWorker to add an worker. I have added river.WorkerDefaults[WorkerArgs] but it still fails on interface check

Cannot use deleteimages.NewWorker() (type *Worker) as the type Worker[T] Type does not implement Worker[T]
need the method: NextRetry(job *Job[T]) time.Time
have the method: NextRetry(*Job[T]) time.Time

Manually specifying NextRetry method fixes the issue

func (w *Worker) NextRetry(_ *river.Job[WorkerArgs]) time.Time {
  return time.Time{}
}

output of go version

go version go1.22.6 linux/arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions