diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2020-12-14 10:44:04 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2020-12-14 10:44:04 +0300 |
commit | 684e462c8953dcf435fe43e937e7d0f068a0ef17 (patch) | |
tree | 5404f2af4909cebf7b63f954d8992501e3334b0a | |
parent | 518ee8d95363ac4b54105f1a272801f2783e8cd0 (diff) |
Removal of redundant verification step
The method directRepositoryScopedMessage is used only in
one place inside of the StreamDirector method. And as the
method is already has a verification of the targetRepo before
directRepositoryScopedMessage method call it has no sense to
do it once again inside it.
-rw-r--r-- | internal/praefect/coordinator.go | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go index 9b31be0cc..4d5d7b6c9 100644 --- a/internal/praefect/coordinator.go +++ b/internal/praefect/coordinator.go @@ -254,20 +254,11 @@ func (c *Coordinator) Collect(metrics chan<- prometheus.Metric) { } func (c *Coordinator) directRepositoryScopedMessage(ctx context.Context, call grpcCall) (*proxy.StreamParameters, error) { - targetRepo, err := call.methodInfo.TargetRepo(call.msg) - if err != nil { - return nil, helper.ErrInvalidArgument(fmt.Errorf("repo scoped: %w", err)) - } - ctxlogrus.AddFields(ctx, logrus.Fields{ "virtual_storage": call.targetRepo.StorageName, "relative_path": call.targetRepo.RelativePath, }) - if targetRepo.StorageName == "" || targetRepo.RelativePath == "" { - return nil, helper.ErrInvalidArgumentf("repo scoped: target repo is invalid") - } - praefectServer, err := metadata.PraefectFromConfig(c.conf) if err != nil { return nil, fmt.Errorf("repo scoped: could not create Praefect configuration: %w", err) @@ -493,8 +484,7 @@ func (c *Coordinator) StreamDirector(ctx context.Context, fullMethodName string, methodInfo: mi, msg: m, targetRepo: targetRepo, - }, - ) + }) if err != nil { if errors.Is(err, nodes.ErrVirtualStorageNotExist) { return nil, helper.ErrInvalidArgument(err) |