[#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 <alexey@nspcc.ru>
This commit is contained in:
parent
a74a402a7d
commit
011d0f605b
2 changed files with 4 additions and 3 deletions
|
@ -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),
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue