File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,11 @@ limitations under the License.
1717package internal
1818
1919import (
20+ "context"
2021 "fmt"
2122 "io"
2223 "net/http"
24+ "time"
2325)
2426
2527type Request struct {
@@ -63,7 +65,11 @@ func NewHttpExecutor(httpClient HttpClient) Executor {
6365}
6466
6567func (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 }
You can’t perform that action at this time.
0 commit comments