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

clientv3: Do no stop keep alive loop by server side errors #7890

Merged
merged 1 commit into from
May 9, 2017

Conversation

yudai
Copy link
Contributor

@yudai yudai commented May 5, 2017

For #7880

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@db6f45e). Click here to learn what that means.
The diff coverage is 89.65%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #7890   +/-   ##
=========================================
  Coverage          ?   76.04%           
=========================================
  Files             ?      332           
  Lines             ?    26233           
  Branches          ?        0           
=========================================
  Hits              ?    19950           
  Misses            ?     4867           
  Partials          ?     1416
Impacted Files Coverage Δ
clientv3/client.go 81.56% <75%> (ø)
clientv3/lease.go 91.6% <95.23%> (ø)

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 db6f45e...4fa2607. Read the comment docs.

Copy link
Contributor

@heyitsanthony heyitsanthony left a comment

Choose a reason for hiding this comment

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

looks ok in general

if err == nil {
return false
}
if err != context.Canceled && err != context.DeadlineExceeded {
Copy link
Contributor

Choose a reason for hiding this comment

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

return err == context.Canceled || err == context.DeadlineExceeded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. I just wanted to return true at the end of the function (now it's false, false, true, false).

Copy link
Contributor

Choose a reason for hiding this comment

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

huh? the if isn't needed, the predicate can be returned directly..

Copy link
Contributor Author

@yudai yudai May 8, 2017

Choose a reason for hiding this comment

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

ah! sorry, I misunderstood your first comment (I thought it was a if statement). Yes, your way is much simpler and easy to understand :) Fixed!

}

err = toErr(l.stopCtx, err)
if err == rpctypes.ErrNoLeader {
Copy link
Contributor

Choose a reason for hiding this comment

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

if toErr(l.stopCtx, err) == rpctypes.ErrNoLeader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@yudai yudai force-pushed the keep_ka_loop_running branch 2 times, most recently from 5cb3418 to cf7eac5 Compare May 8, 2017 20:43
@heyitsanthony
Copy link
Contributor

lgtm

@heyitsanthony
Copy link
Contributor

/cc @xiang90 @mwf

@@ -503,3 +503,14 @@ func toErr(ctx context.Context, err error) error {
}
return err
}

func canceledByCaller(ctx context.Context, err error) bool {
if ctx.Err() == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

if ctx.Err() == nil || err == nil {
    return false
}

Copy link
Contributor

Choose a reason for hiding this comment

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

probably also rename ctx to stopCtx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Done.

@xiang90
Copy link
Contributor

xiang90 commented May 8, 2017

@yudai We probably want a test to cover this. It can be a different PR though. LGTM.

@yudai
Copy link
Contributor Author

yudai commented May 8, 2017

@xiang90 Adding a test could take a little bit time. Because I think we need a mock server that returns unexpected (not in isHaltErr()) errors.

@xiang90
Copy link
Contributor

xiang90 commented May 9, 2017

CI is fixed on master. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants