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

added code comments #4219

Merged
merged 3 commits into from
Jul 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update
guonaihong authored and kevwan committed Jul 13, 2024
commit 2d9f4c64151c32ba2617b3e8ec871b1660db0194
21 changes: 1 addition & 20 deletions zrpc/internal/balancer/p2c/p2c.go
Original file line number Diff line number Diff line change
@@ -122,27 +122,8 @@ func (p *p2cPicker) buildDoneFunc(c *subConn) func(info balancer.DoneInfo) {
td = 0
}

// The function curve of y = x^(-x) is as follows.
// *
// *
// *
// *
// *
// *
// *
// *
// *
// *
// **
// *
// ***
// **
// ****
// ******
// *********************
// *
//
// As the td/decayTime value increases, indicating an increase in delay, the value of w (y axis) will decrease, inversely proportional.
// The function curve of y = x^(-x) is as follows.
// https://github.com/zeromicro/zero-doc/blob/main/doc/images/y_e_x.png?raw=true
w := math.Exp(float64(-td) / float64(decayTime))
lag := int64(now) - start