summaryrefslogtreecommitdiff
path: root/socket_factory.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2020-10-25 15:55:51 +0300
committerWolfy-J <[email protected]>2020-10-25 15:55:51 +0300
commitba5c562f9038ba434e655fb82c44597fcccaff16 (patch)
treeff112b9dcffda63bc40094a57d0df61622368445 /socket_factory.go
parent3bdf7d02d83d1ff4726f3fbb01a45d016f39abec (diff)
- massive update in roadrunner 2.0 abstractions
Diffstat (limited to 'socket_factory.go')
-rw-r--r--socket_factory.go8
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 {