diff --git a/internal/executors/sandbox/executor.go b/internal/executors/sandbox/executor.go index 6a61022..df01796 100644 --- a/internal/executors/sandbox/executor.go +++ b/internal/executors/sandbox/executor.go @@ -10,11 +10,15 @@ import ( ) type Sandbox struct { - execClient pb.ExecutorClient - cachedMap map[string]string + execServer, token string + cachedMap map[string]string + execClient pb.ExecutorClient } 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 for i := 0; i < len(cmds); i++ { cmd := &cmds[i] diff --git a/internal/executors/sandbox/meta.go b/internal/executors/sandbox/meta.go index c22b750..2702646 100644 --- a/internal/executors/sandbox/meta.go +++ b/internal/executors/sandbox/meta.go @@ -9,7 +9,8 @@ var name = "sandbox" func init() { stage.RegisterExecutor(name, &Sandbox{ // TODO: read from conf - execClient: createExecClient("localhost:5051", ""), + execServer: "localhost:5051", + token: "", cachedMap: make(map[string]string), }) }