feat: postpone sandbox grpc connection time
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f6cbfa7973
commit
2237ce41eb
|
@ -10,11 +10,15 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sandbox struct {
|
type Sandbox struct {
|
||||||
execClient pb.ExecutorClient
|
execServer, token string
|
||||||
cachedMap map[string]string
|
cachedMap map[string]string
|
||||||
|
execClient pb.ExecutorClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
|
if e.execClient == nil {
|
||||||
|
e.execClient = createExecClient(e.execServer, e.token)
|
||||||
|
}
|
||||||
// cannot use range loop since we need to change the value
|
// cannot use range loop since we need to change the value
|
||||||
for i := 0; i < len(cmds); i++ {
|
for i := 0; i < len(cmds); i++ {
|
||||||
cmd := &cmds[i]
|
cmd := &cmds[i]
|
||||||
|
|
|
@ -9,7 +9,8 @@ var name = "sandbox"
|
||||||
func init() {
|
func init() {
|
||||||
stage.RegisterExecutor(name, &Sandbox{
|
stage.RegisterExecutor(name, &Sandbox{
|
||||||
// TODO: read from conf
|
// TODO: read from conf
|
||||||
execClient: createExecClient("localhost:5051", ""),
|
execServer: "localhost:5051",
|
||||||
|
token: "",
|
||||||
cachedMap: make(map[string]string),
|
cachedMap: make(map[string]string),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user