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

LBAAS Fixup default http idle timeout behaviour #580

Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions load_balancers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const loadBalancersBasePath = "/v2/load_balancers"
const forwardingRulesPath = "forwarding_rules"

const dropletsPath = "droplets"
const defaultHttpIdleTimeout = 60

// LoadBalancersService is an interface for managing load balancers with the DigitalOcean API.
// See: https://docs.digitalocean.com/reference/api/api-reference/#tag/Load-Balancers
Expand Down Expand Up @@ -104,10 +103,6 @@ func (l LoadBalancer) AsRequest() *LoadBalancerRequest {
r.Region = l.Region.Slug
}

if l.HTTPIdleTimeoutSeconds == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@StephenVarela is the diff link supposed to reference a specific line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hrmm thats weird sorry I meant to point to line 88 in this file (load_balancers.go) https://github.com/digitalocean/godo/blob/main/load_balancers.go#L88

Copy link
Contributor

Choose a reason for hiding this comment

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

I just understood your wording "setting this here ... should be sufficient" to mean the link was pointing elsewhere since the comment is on removed code.

defaultTimeout := uint64(defaultHttpIdleTimeout)
r.HTTPIdleTimeoutSeconds = &defaultTimeout
}
return &r
}

Expand Down
6 changes: 4 additions & 2 deletions load_balancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ func TestLoadBalancers_RemoveForwardingRules(t *testing.T) {
}

func TestLoadBalancers_AsRequest(t *testing.T) {
lbIdleTimeout := uint64(60)
lb := &LoadBalancer{
ID: "37e6be88-01ec-4ec7-9bc6-a514d4719057",
Name: "test-loadbalancer",
Expand Down Expand Up @@ -973,7 +974,9 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
ValidateOnly: true,
HTTPIdleTimeoutSeconds: &lbIdleTimeout,
}

lb.DropletIDs = make([]int, 1, 2)
lb.DropletIDs[0] = 12345
lb.ForwardingRules = make([]ForwardingRule, 1, 2)
Expand All @@ -984,7 +987,6 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
TargetPort: 80,
}

expectedIdleTimeout := uint64(60)
want := &LoadBalancerRequest{
Name: "test-loadbalancer",
Algorithm: "least_connections",
Expand Down Expand Up @@ -1016,7 +1018,7 @@ func TestLoadBalancers_AsRequest(t *testing.T) {
EnableBackendKeepalive: true,
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
ProjectID: "6929eef6-4e45-11ed-bdc3-0242ac120002",
HTTPIdleTimeoutSeconds: &expectedIdleTimeout,
HTTPIdleTimeoutSeconds: &lbIdleTimeout,
ValidateOnly: true,
}

Expand Down