From 0de18a4d3e07344148aace44d68d946ac0a28bf8 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Mon, 17 Feb 2020 14:57:50 +0100 Subject: [PATCH] spawn as a separate goroutine --- pkg/micro/runtime/runtime.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/micro/runtime/runtime.go b/pkg/micro/runtime/runtime.go index 9745fe485f..8129e1a642 100644 --- a/pkg/micro/runtime/runtime.go +++ b/pkg/micro/runtime/runtime.go @@ -108,18 +108,14 @@ func (r Runtime) Trap() { func (r *Runtime) Start() { env := os.Environ() - for _, service := range r.services { - // TODO uncommenting this line causes some issues where the binary calls itself with the `server` as argument - r.Logger.Info().Msgf("args: %v %v", os.Args[0], service.Name) + for i := range r.services { args := []gorun.CreateOption{ - gorun.WithCommand(os.Args[0], service.Name), + gorun.WithCommand(os.Args[0], r.services[i].Name), gorun.WithEnv(env), gorun.WithOutput(os.Stdout), } - if err := (*r.R).Create(service, args...); err != nil { - r.Logger.Error().Msgf("Failed to create runtime enviroment: %v", err) - } + go (*r.R).Create(r.services[i], args...) } }