From b0165156585bfc9e196c039b38d5c62295bbe3ae Mon Sep 17 00:00:00 2001 From: Bruce Riley Date: Mon, 7 Aug 2023 14:00:35 -0500 Subject: [PATCH] Simplify use of RunWithScissors --- node/pkg/processor/processor.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/node/pkg/processor/processor.go b/node/pkg/processor/processor.go index b63ecc0189..122d3cf1db 100644 --- a/node/pkg/processor/processor.go +++ b/node/pkg/processor/processor.go @@ -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