Skip to content

Commit

Permalink
max_concurrent_requests
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Nov 28, 2024
1 parent bd9f9d0 commit ed9911e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions civo/loadbalancer/resource_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ func resourceLoadBalancerCreate(ctx context.Context, d *schema.ResourceData, m i
}

if v, ok := d.GetOk("max_concurrent_requests"); ok {
num := v.(int)
conf.MaxConcurrentRequests = &num
conf.MaxConcurrentRequests = utils.IntPtr(v.(int))
}

// Set backend configurations if provided
Expand Down Expand Up @@ -403,6 +402,10 @@ func resourceLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, m i
updateRequest.SessionAffinityConfigTimeout = int32(d.Get("session_affinity_config_timeout").(int))
}

if d.HasChange("max_concurrent_requests") {
updateRequest.MaxConcurrentRequests = utils.IntPtr(d.Get("max_concurrent_requests").(int))
}

if d.HasChange("enable_proxy_protocol") {
updateRequest.EnableProxyProtocol = d.Get("enable_proxy_protocol").(string)
}
Expand Down
7 changes: 6 additions & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func ValidateUUID(v interface{}, k string) (ws []string, errors []error) {
return
}

// CheckFileSize function checks if the file the file size is less than the allowed limit(current: 20MB)
// CheckFileSize function checks if the file size is less than the allowed limit(current: 20MB)
func CheckFileSize(path string) error {
fileInfo, err := os.Stat(path)
if err != nil {
Expand All @@ -340,3 +340,8 @@ func CheckFileSize(path string) error {
}
return nil
}

// IntPtr returns a pointer to an int
func IntPtr(i int) *int {
return &i
}

0 comments on commit ed9911e

Please sign in to comment.