Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix remove unneccessary error return & add grpc status code handling for backoff #1253

Merged
merged 6 commits into from
May 24, 2021

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented May 24, 2021

Signed-off-by: kpango [email protected]

Description:

bugfix remove unneccessary error return
add grpc status code handling for backoff

Related Issue:

How Has This Been Tested?:

Environment:

  • Go Version: 1.16.4
  • Docker Version: 19.03.8
  • Kubernetes Version: 1.18.2
  • NGT Version: 1.12.3

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@vdaas-ci
Copy link
Collaborator

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 💌 /changelog - replace the PR body by changelog details
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • /rebase - rebase master
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

if !ok {
return nil, err != nil, err
}
switch st.Code() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type codes.Code: Aborted, AlreadyExists, Canceled, DataLoss, DeadlineExceeded, FailedPrecondition, InvalidArgument, NotFound, OK, OutOfRange, PermissionDenied, Unauthenticated, Unimplemented, Unknown (exhaustive)

if !ok {
return nil, err != nil, err
}
switch st.Code() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
missing cases in switch of type codes.Code: Aborted, AlreadyExists, Canceled, DataLoss, DeadlineExceeded, FailedPrecondition, InvalidArgument, NotFound, OK, OutOfRange, PermissionDenied, Unauthenticated, Unimplemented, Unknown (exhaustive)

@codecov
Copy link

codecov bot commented May 24, 2021

Codecov Report

Merging #1253 (c0f5cad) into master (53de600) will decrease coverage by 0.57%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1253      +/-   ##
==========================================
- Coverage   18.05%   17.47%   -0.58%     
==========================================
  Files         501      498       -3     
  Lines       31198    30948     -250     
==========================================
- Hits         5633     5409     -224     
+ Misses      25266    25261       -5     
+ Partials      299      278      -21     
Impacted Files Coverage Δ
internal/net/grpc/client.go 0.00% <0.00%> (ø)
pkg/agent/core/ngt/handler/grpc/handler.go 0.00% <0.00%> (ø)
pkg/gateway/lb/handler/grpc/handler.go 0.00% <0.00%> (ø)
pkg/gateway/lb/service/gateway.go 0.00% <0.00%> (ø)
pkg/gateway/meta/handler/grpc/handler.go 0.00% <0.00%> (ø)
internal/worker/queue.go 98.33% <0.00%> (-1.67%) ⬇️
internal/worker/worker.go 81.25% <0.00%> (-1.05%) ⬇️
internal/net/option.go
internal/net/net.go
internal/net/dialer.go
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53de600...c0f5cad. Read the comment docs.

Signed-off-by: kpango <[email protected]>
@github-actions github-actions bot added size/L and removed size/M labels May 24, 2021
kpango added 2 commits May 24, 2021 19:40
Signed-off-by: kpango <[email protected]>
Signed-off-by: kpango <[email protected]>
}
}
}
return rerr
}

func (g *gRPCClient) OrderedRangeConcurrent(ctx context.Context,
orders []string, concurrency int, f func(ctx context.Context, addr string, conn *ClientConn, copts ...CallOption) error) (err error) {
orders []string, concurrency int, f func(ctx context.Context, addr string, conn *ClientConn, copts ...CallOption) error) (rerr error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
line is 136 characters (lll)

@@ -386,15 +414,20 @@ func (g *gRPCClient) OrderedRange(ctx context.Context,
return nil, f(ictx, addr, conn, copts...)
})
if err != nil {
rerr = errors.Wrap(rerr, errors.ErrRPCCallFailed(addr, err).Error())
err = errors.ErrRPCCallFailed(addr, err)
if rerr == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments used in the if statement itself (wsl)

kpango added 2 commits May 24, 2021 20:00
Signed-off-by: kpango <[email protected]>
Signed-off-by: kpango <[email protected]>
@@ -103,11 +110,30 @@ func (g *gateway) DoMulti(ctx context.Context, num int,
return err
}
atomic.AddUint32(&cur, 1)
visited.Store(addr, struct{}{})
}
return nil
})
if err != nil && cur < limit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
if err != nil && cur < limit is deeply nested (complexity: 7) (nestif)

}
return nil
})
if err != nil && cur < limit {
return err
if err != nil || cur < limit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
if err != nil || cur < limit is deeply nested (complexity: 7) (nestif)

Copy link
Contributor

@kevindiu kevindiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kpango kpango merged commit 4e4367c into master May 24, 2021
@kpango kpango deleted the bugfix/gateway/unneccessary-error-return branch May 24, 2021 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants