summaryrefslogtreecommitdiff
path: root/socket_factory.go
diff options
context:
space:
mode:
Diffstat (limited to 'socket_factory.go')
-rwxr-xr-xsocket_factory.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/socket_factory.go b/socket_factory.go
index 27558cce..ed151f2d 100755
--- a/socket_factory.go
+++ b/socket_factory.go
@@ -8,6 +8,8 @@ import (
"sync"
"time"
+ "github.com/shirou/gopsutil/process"
+
"github.com/pkg/errors"
"github.com/spiral/goridge/v2"
"go.uber.org/multierr"
@@ -110,6 +112,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 +181,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 {