Skip to content

Commit c1b775a

Browse files
committed
internal: Fixed the cluster status cannot be changed after the POD exception exits. #353
1 parent b31899b commit c1b775a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/http_executor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ limitations under the License.
1717
package internal
1818

1919
import (
20+
"context"
2021
"fmt"
2122
"io"
2223
"net/http"
24+
"time"
2325
)
2426

2527
type Request struct {
@@ -63,7 +65,9 @@ func NewHttpExecutor(httpClient HttpClient) Executor {
6365
}
6466

6567
func (executor *httpExecutor) Execute(req *Request) (*Response, error) {
66-
resp, err := executor.Client.Do(req.Req)
68+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
69+
defer cancel()
70+
resp, err := executor.Client.Do(req.Req.WithContext(ctx))
6771
if err != nil {
6872
return nil, err
6973
}

0 commit comments

Comments
 (0)