Add timeout for rkt requests.

This commit is contained in:
Random-Liu
2016-06-17 14:28:30 -07:00
parent 52ebd4ecf1
commit 3cc9ca3988
6 changed files with 50 additions and 11 deletions

View File

@@ -79,7 +79,9 @@ func (c *Config) buildGlobalOptions() []string {
// that the fields in the provided config will override the
// result that get from the rkt api service.
func (r *Runtime) getConfig(cfg *Config) (*Config, error) {
resp, err := r.apisvc.GetInfo(context.Background(), &rktapi.GetInfoRequest{})
ctx, cancel := context.WithTimeout(context.Background(), r.requestTimeout)
defer cancel()
resp, err := r.apisvc.GetInfo(ctx, &rktapi.GetInfoRequest{})
if err != nil {
return nil, err
}