Skip to content

Commit

Permalink
WIP: Remove backoff from notify planner
Browse files Browse the repository at this point in the history
  • Loading branch information
salvacorts committed Jul 12, 2024
1 parent 4ca9785 commit 547696b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
6 changes: 6 additions & 0 deletions pkg/bloombuild/builder/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ func (i *blockLoadingIter) loadNext() bool {
// Next implements v1.Iterator.
func (i *blockLoadingIter) Next() bool {
i.init()

if i.ctx.Err() != nil {
i.err = i.ctx.Err()
return false
}

return i.iter.Next() || i.loadNext()
}

Expand Down
20 changes: 4 additions & 16 deletions pkg/bloombuild/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,10 @@ func (b *Builder) notifyTaskCompletedToPlanner(
CreatedMetas: metas,
}

// We have a retry mechanism upper in the stack, but we add another one here
// to try our best to avoid losing the task result.
retries := backoff.New(c.Context(), b.cfg.BackoffConfig)
for retries.Ongoing() {
if err := c.Send(&protos.BuilderToPlanner{
BuilderID: b.ID,
Result: *result.ToProtoTaskResult(),
}); err == nil {
break
}

level.Error(logger).Log("msg", "failed to acknowledge task completion to planner. Retrying", "err", err)
retries.Wait()
}

if err := retries.Err(); err != nil {
if err := c.Send(&protos.BuilderToPlanner{
BuilderID: b.ID,
Result: *result.ToProtoTaskResult(),
}); err != nil {
return fmt.Errorf("failed to acknowledge task completion to planner: %w", err)
}

Expand Down

0 comments on commit 547696b

Please sign in to comment.