Skip to content

Commit

Permalink
Simplify use of RunWithScissors
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Aug 15, 2023
1 parent a5ff6e5 commit b016515
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions node/pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,26 +243,12 @@ func (p *Processor) Run(ctx context.Context) error {
}

// Start the routine to do housekeeping tasks that don't need to be distributed to the workers.
common.RunWithScissors(ctx, errC, "processor_housekeeper",
func(ctx context.Context) error {
err := p.runHousekeeper(ctx)
if err != nil {
errC <- fmt.Errorf("processor housekeeper failed: %v", err)
}
return err
})
common.RunWithScissors(ctx, errC, "processor_housekeeper", p.runHousekeeper)

// Start the workers.
for workerId := 1; workerId <= numWorkers; workerId++ {
workerId := workerId
common.RunWithScissors(ctx, errC, fmt.Sprintf("processor_worker_%d", workerId),
func(ctx context.Context) error {
err := p.runWorker(ctx)
if err != nil {
errC <- fmt.Errorf("processor worker %d failed: %v", workerId, err)
}
return err
})
common.RunWithScissors(ctx, errC, fmt.Sprintf("processor_worker_%d", workerId), p.runWorker)
}

var err error
Expand Down

0 comments on commit b016515

Please sign in to comment.