Conversation
ignore invalid certs
dont open browser if browser url not entered
multiple calls going out
This reverts commit aaaad7a
# Conflicts: # main.go # pkg/instance/instance.go
There was a problem hiding this comment.
Code Review
This pull request introduces several improvements, including the addition of an 'InsecureSkipVerify' option for HTTP requests, enhanced panic recovery across event handlers, and a more robust ticker-based execution loop for background tasks. Regarding the review feedback, it is recommended to optimize the HTTP client management in 'pkg/executor/executor.go' by reusing clients instead of creating a new one for every request to prevent potential socket exhaustion.
| client := req.C() | ||
| if executeReq.Config.InsecureSkipVerify { | ||
| client.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}) | ||
| } | ||
| httpReq := client.NewRequest() |
There was a problem hiding this comment.
Creating a new HTTP client with req.C() for every Execute call is inefficient. http.Client (which req.Client wraps) is designed for reuse. Frequent creation can lead to resource issues like socket exhaustion (TIME_WAIT state).
To improve this, you could create and manage req.Client instances within the Executor struct. For example, you could have one client for secure connections and another for insecure connections, and choose the appropriate one here based on executeReq.Config.InsecureSkipVerify.
Fixed: