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

feat: add square wave latency summand #17

Merged
merged 5 commits into from
Aug 2, 2022
Merged

Conversation

szkf
Copy link
Contributor

@szkf szkf commented Aug 1, 2022

This PR adds a square wave latency summand. Since the TestSpeedbumpWithEchoServer was sometimes failing, I've also added a loop retrying TCP dials in case the proxy in a separate goroutine hasn't started listening yet.

Resolves #16

Copy link
Owner

@kffl kffl left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to create this PR!

Changes look great. The only request I have regarding the code itself is related to the square wave formula. Also, would you mind adding the updated --help output to README?

Comment on lines +144 to +156
var conn *net.TCPConn

// Wait for the speedbump instance to start listening
// since it is started in a separate goroutine, we don't know
// if it has already started listening by this point
for {
conn, err = net.DialTCP("tcp", nil, tcpAddr)
if err != nil {
time.Sleep(10 * time.Millisecond)
} else {
break
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

This test bug was causing the CI pipeline to fail every once in a while. Thanks for fixing it.

On a side note, it shows that the public API could be a bit more intuitive (i.e. Start() that returns immediately after the proxy starts listening). Such changes will likely be introduced in v1 due to their breaking nature.

lib/square.go Outdated Show resolved Hide resolved
@szkf szkf requested a review from kffl August 2, 2022 20:04
Copy link
Owner

@kffl kffl left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@kffl kffl merged commit a556c99 into kffl:master Aug 2, 2022
@kffl kffl mentioned this pull request Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Square wave latency summand
2 participants