Skip to content

Commit 12daad7

Browse files
authored
Merge pull request radondb#366 from runkecheng/fix_kill_pod_cannot_failover
internal: Fixed the cluster status cannot be changed after the POD ex…
2 parents 0debeb9 + 3856034 commit 12daad7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/http_executor.go

Lines changed: 7 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,11 @@ 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+
// Add timeout to prevent access from not existing POD, this will cause the program to block.
69+
// https://github.com/radondb/radondb-mysql-kubernetes/issues/353
70+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
71+
defer cancel()
72+
resp, err := executor.Client.Do(req.Req.WithContext(ctx))
6773
if err != nil {
6874
return nil, err
6975
}

0 commit comments

Comments
 (0)