diff --git a/executor/client/client.go b/executor/client/client.go index 9214c97..3ba4ed0 100644 --- a/executor/client/client.go +++ b/executor/client/client.go @@ -23,7 +23,8 @@ import ( const ( DefaultCacheSize = 1024 * 1024 - DefaultDialTimeout = time.Second * 15 + DefaultDialTimeout = time.Minute * 3 + DefaultExecTimeout = time.Minute * 10 ) const ( @@ -162,12 +163,14 @@ type ExecOptions struct { Root string Args []string Environments map[string]string + Timeout time.Duration } func NewExecOptions() *ExecOptions { opt := &ExecOptions{ Context: context.TODO(), Environments: map[string]string{}, + Timeout: DefaultExecTimeout, } return opt } @@ -195,6 +198,12 @@ func ExecWithEnv(key, value string) ExecOption { } } +func ExecWithTimeout(timeout time.Duration) ExecOption { + return func(options *ExecOptions) { + options.Timeout = timeout + } +} + // ExecWithValue set key-value at options.Context func ExecWithValue(key string, value any) ExecOption { return func(options *ExecOptions) {