summaryrefslogtreecommitdiff
path: root/plugins/jobs/drivers/beanstalk/requeue.go
blob: 2105394033dfc49d73a551416541c829d12eef19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package beanstalk

import "context"

// requeueListener should handle items passed to requeue
func (j *JobConsumer) requeueListener() {
	go func() {
		for { //nolint:gosimple
			select {
			case item, ok := <-j.requeueCh:
				if !ok {
					j.log.Info("requeue channel closed")
					return
				}

				err := j.handleItem(context.TODO(), item)
				if err != nil {
					j.log.Error("requeue handle item", "error", err)
					continue
				}
			}
		}
	}()
}