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

Do not use http proxy transport when doing healtchecks #121

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@
}
switch globalHostBalance {
case "least":
min := int64(math.MaxInt64)

Check failure on line 581 in main.go

View workflow job for this annotation

GitHub Actions / Test on Go 1.22.x and ubuntu-latest

redefines-builtin-id: redefinition of the built-in function min (revive)
earliest := int64(math.MaxInt64)
idx := 0
// Shuffle before picking the least connection to ensure all nodes
Expand All @@ -589,7 +589,7 @@
for i, backend := range backends {
currentCalls := backend.Stats.CurrentCalls.Load()
if currentCalls < min {
min = currentCalls

Check failure on line 592 in main.go

View workflow job for this annotation

GitHub Actions / Test on Go 1.22.x and ubuntu-latest

redefines-builtin-id: redefinition of the built-in function min (revive)
lastFinished := backend.Stats.LastFinished.Load()
if lastFinished < earliest {
earliest = lastFinished
Expand Down Expand Up @@ -955,7 +955,7 @@
console.Fatalln(err)
}
backend := &Backend{siteNum, endpoint, proxy, &http.Client{
Transport: proxy.Transport,
Transport: transport,
Copy link
Member

Choose a reason for hiding this comment

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

While correct - isn't this the same transport instance?
We set Transport: transport, above

Copy link
Member Author

@vadmeste vadmeste Nov 14, 2024

Choose a reason for hiding this comment

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

yes you are right. I found a way to reproduce an issue consistently, this does not fix anything. Transport is thread safe already. Closing this.

}, 0, healthCheckURL, opts.healthCheckDuration, opts.healthCheckTimeout, &stats}
go backend.healthCheck(ctxt)
proxy.ErrorHandler = backend.ErrorHandler
Expand Down
Loading