riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.34k stars 89 forks source link

Worker with embeded WorkerDefaults does not implement Worker interface #562

Closed taras-turchenko-moc closed 2 weeks ago

taras-turchenko-moc commented 2 weeks ago

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