diff options
Diffstat (limited to 'plugins/jobs/drivers/beanstalk/requeue.go')
-rw-r--r-- | plugins/jobs/drivers/beanstalk/requeue.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/jobs/drivers/beanstalk/requeue.go b/plugins/jobs/drivers/beanstalk/requeue.go new file mode 100644 index 00000000..21053940 --- /dev/null +++ b/plugins/jobs/drivers/beanstalk/requeue.go @@ -0,0 +1,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 + } + } + } + }() +} |