Skip to content

Commit

Permalink
jobloop: fix counting of failed tasks in single-threaded ProducerCons…
Browse files Browse the repository at this point in the history
…umerJob
  • Loading branch information
majewsky committed Sep 12, 2023
1 parent 81ca24d commit 3a5bef4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jobloop/producer_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ type producerConsumerJobImpl[T any] struct {
func (j *ProducerConsumerJob[T]) produceOne(ctx context.Context, cfg jobConfig, annotateErrors bool) (T, prometheus.Labels, error) {
labels := j.Metadata.makeLabels(cfg)
task, err := j.DiscoverTask(ctx, labels)
if err != nil && !errors.Is(err, sql.ErrNoRows) && annotateErrors {
err = fmt.Errorf("could not select task%s for job %q: %w",
cfg.PrefilledLabelsAsString(), j.Metadata.ReadableName, err)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
if annotateErrors {
err = fmt.Errorf("could not select task%s for job %q: %w",
cfg.PrefilledLabelsAsString(), j.Metadata.ReadableName, err)
}
j.Metadata.countTask(labels, err)
}
return task, labels, err
Expand Down

0 comments on commit 3a5bef4

Please sign in to comment.