mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
Merge pull request #517 from jcvenegas/issue-516-timeout-centos
agent: Increase timeout for check request.
This commit is contained in:
commit
c5075d08ed
@ -34,6 +34,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
checkRequestTimeout = 30 * time.Second
|
||||
defaultKataSocketName = "kata.sock"
|
||||
defaultKataChannel = "agent.channel.0"
|
||||
defaultKataDeviceID = "channel0"
|
||||
@ -1229,8 +1230,12 @@ func (k *kataAgent) disconnect() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// check grpc server is serving
|
||||
func (k *kataAgent) check() error {
|
||||
_, err := k.sendReq(&grpc.CheckRequest{})
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Failed to check if grpc server is working: %s", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -1274,7 +1279,7 @@ type reqFunc func(context.Context, interface{}, ...golangGrpc.CallOption) (inter
|
||||
func (k *kataAgent) installReqFunc(c *kataclient.AgentClient) {
|
||||
k.reqHandlers = make(map[string]reqFunc)
|
||||
k.reqHandlers["grpc.CheckRequest"] = func(ctx context.Context, req interface{}, opts ...golangGrpc.CallOption) (interface{}, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||
ctx, cancel := context.WithTimeout(ctx, checkRequestTimeout)
|
||||
defer cancel()
|
||||
return k.client.Check(ctx, req.(*grpc.CheckRequest), opts...)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user