From 011d0f605b8149d3dc42b660f214b7f39fb4a116 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 10 Nov 2021 14:47:52 +0300 Subject: [PATCH] [#965] replicator: Make HandleTask function public Continues replication executed in separate pool of goroutines, so there is no need in worker to handle replication tasks asynchronously. Signed-off-by: Alex Vanin --- pkg/services/policer/check.go | 2 +- pkg/services/replicator/process.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index ca75e7cdf6..29b6e4c2c3 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -118,7 +118,7 @@ func (p *Policer) processNodes(ctx context.Context, addr *object.Address, nodes zap.Uint32("shortage", shortage), ) - p.replicator.AddTask(new(replicator.Task). + p.replicator.HandleTask(ctx, new(replicator.Task). WithObjectAddress(addr). WithNodes(nodes). WithCopiesNumber(shortage), diff --git a/pkg/services/replicator/process.go b/pkg/services/replicator/process.go index fae8fea1c3..825e83b19e 100644 --- a/pkg/services/replicator/process.go +++ b/pkg/services/replicator/process.go @@ -37,12 +37,13 @@ func (p *Replicator) Run(ctx context.Context) { return } - p.handleTask(ctx, task) + p.HandleTask(ctx, task) } } } -func (p *Replicator) handleTask(ctx context.Context, task *Task) { +// HandleTask executes replication task inside invoking goroutine. +func (p *Replicator) HandleTask(ctx context.Context, task *Task) { defer func() { p.log.Info("finish work", zap.Uint32("amount of unfinished replicas", task.quantity),