[#195] services/object: Write debug log messages on worker pool errors

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-23 15:23:32 +03:00 committed by Alex Vanin
parent fa6e4a3ca4
commit 46dab77705
6 changed files with 26 additions and 8 deletions

View file

@ -125,7 +125,9 @@ loop:
h.w.write(head)
}); err != nil {
wg.Done()
// TODO: log error
svcutil.LogWorkerPoolError(h.log, "HEAD", err)
break loop
}
}

View file

@ -103,7 +103,9 @@ loop:
traverser.SubmitSuccess()
}); err != nil {
wg.Done()
// TODO: log error
svcutil.LogWorkerPoolError(t.log, "PUT", err)
break loop
}
}

View file

@ -205,7 +205,9 @@ loop:
nextRange.SetOffset(nextRange.GetOffset() + uw)
}); err != nil {
wg.Done()
// TODO: log error
svcutil.LogWorkerPoolError(p.log, "RANGE", err)
break loop
}

View file

@ -125,7 +125,9 @@ loop:
}
}); err != nil {
wg.Done()
// TODO: log error
svcutil.LogWorkerPoolError(h.log, "RANGEHASH", err)
break loop
}
}

View file

@ -8,7 +8,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
"github.com/nspcc-dev/neofs-node/pkg/network"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
svcutil "github.com/nspcc-dev/neofs-node/pkg/services/object/util"
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
"github.com/pkg/errors"
)
@ -113,7 +113,7 @@ func (p *Streamer) preparePrm(prm *Prm) error {
traverseOpts = append(traverseOpts, placement.SuccessAfter(1))
// use local-only placement builder
builder = util.NewLocalPlacement(builder, p.localAddrSrc)
builder = svcutil.NewLocalPlacement(builder, p.localAddrSrc)
}
// set placement builder
@ -169,11 +169,13 @@ loop:
}
if err := streamer.stream(p.ctx, p.ch); err != nil {
util.LogServiceError(p.log, "SEARCH", addr, err)
svcutil.LogServiceError(p.log, "SEARCH", addr, err)
}
}); err != nil {
wg.Done()
// TODO: log error
svcutil.LogWorkerPoolError(p.log, "SEARCH", err)
break loop
}
}

View file

@ -14,3 +14,11 @@ func LogServiceError(l *logger.Logger, req string, node *network.Address, err er
zap.String("error", err.Error()),
)
}
// LogWorkerPoolError writes debug error message of object worker pool to provided logger.
func LogWorkerPoolError(l *logger.Logger, req string, err error) {
l.Debug("could not push task to worker pool",
zap.String("request", req),
zap.String("error", err.Error()),
)
}