diff options
Diffstat (limited to 'socket_factory.go')
-rw-r--r-- | socket_factory.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/socket_factory.go b/socket_factory.go index 27558cce..0db7849b 100644 --- a/socket_factory.go +++ b/socket_factory.go @@ -2,6 +2,7 @@ package roadrunner import ( "context" + "github.com/shirou/gopsutil/process" "net" "os/exec" "strings" @@ -110,6 +111,7 @@ func (f *SocketFactory) SpawnWorkerWithContext(ctx context.Context, cmd *exec.Cm w.Kill(context.Background()), w.Wait(context.Background()), ) + c <- socketSpawn{ w: nil, err: err, @@ -178,10 +180,16 @@ func (f *SocketFactory) Close(ctx context.Context) error { // waits for WorkerProcess to connect over socket and returns associated relay of timeout func (f *SocketFactory) findRelayWithContext(ctx context.Context, w WorkerBase) (*goridge.SocketRelay, error) { + ticker := time.NewTicker(time.Millisecond * 100) for { select { case <-ctx.Done(): return nil, ctx.Err() + case <-ticker.C: + _, err := process.NewProcess(int32(w.Pid())) + if err != nil { + return nil, err + } default: tmp, ok := f.relays.Load(w.Pid()) if !ok { |