diff options
Diffstat (limited to 'pkg/pool')
-rwxr-xr-x | pkg/pool/static_pool.go | 8 | ||||
-rwxr-xr-x | pkg/pool/static_pool_test.go | 6 | ||||
-rwxr-xr-x | pkg/pool/supervisor_pool.go | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go index 44adf9c0..01b0574d 100755 --- a/pkg/pool/static_pool.go +++ b/pkg/pool/static_pool.go @@ -6,9 +6,9 @@ import ( "time" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/events" "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/states" "github.com/spiral/roadrunner/v2/pkg/transport" "github.com/spiral/roadrunner/v2/pkg/worker" workerWatcher "github.com/spiral/roadrunner/v2/pkg/worker_watcher" @@ -195,7 +195,7 @@ func (sp *StaticPool) ExecWithContext(ctx context.Context, p payload.Payload) (p func (sp *StaticPool) stopWorker(w worker.SyncWorker) { const op = errors.Op("static_pool_stop_worker") - w.State().Set(internal.StateInvalid) + w.State().Set(states.StateInvalid) err := w.Stop() if err != nil { sp.events.Push(events.WorkerEvent{Event: events.EventWorkerError, Worker: w, Payload: errors.E(op, err)}) @@ -251,7 +251,7 @@ func defaultErrEncoder(sp *StaticPool) ErrorEncoder { sp.events.Push(events.PoolEvent{Event: events.EventWorkerConstruct, Payload: errors.E(op, err)}) } - w.State().Set(internal.StateInvalid) + w.State().Set(states.StateInvalid) err = w.Stop() if err != nil { sp.events.Push(events.WorkerEvent{Event: events.EventWorkerError, Worker: w, Payload: errors.E(op, err)}) @@ -263,7 +263,7 @@ func defaultErrEncoder(sp *StaticPool) ErrorEncoder { return payload.Payload{}, errors.E(op, err) } - w.State().Set(internal.StateInvalid) + w.State().Set(states.StateInvalid) sp.events.Push(events.PoolEvent{Event: events.EventWorkerDestruct, Payload: w}) errS := w.Stop() diff --git a/pkg/pool/static_pool_test.go b/pkg/pool/static_pool_test.go index a32790e0..2d2b2b7d 100755 --- a/pkg/pool/static_pool_test.go +++ b/pkg/pool/static_pool_test.go @@ -12,9 +12,9 @@ import ( "time" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/events" "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/states" "github.com/spiral/roadrunner/v2/pkg/transport/pipe" "github.com/stretchr/testify/assert" ) @@ -255,7 +255,7 @@ func Test_StaticPool_Broken_FromOutside(t *testing.T) { list := p.Workers() for _, w := range list { - assert.Equal(t, internal.StateReady, w.State().Value()) + assert.Equal(t, states.StateReady, w.State().Value()) } } @@ -462,7 +462,7 @@ func Test_Static_Pool_Handle_Dead(t *testing.T) { assert.NotNil(t, p) for i := range p.Workers() { - p.Workers()[i].State().Set(internal.StateErrored) + p.Workers()[i].State().Set(states.StateErrored) } _, err = p.Exec(payload.Payload{Body: []byte("hello")}) diff --git a/pkg/pool/supervisor_pool.go b/pkg/pool/supervisor_pool.go index 2597b352..3347ecd4 100755 --- a/pkg/pool/supervisor_pool.go +++ b/pkg/pool/supervisor_pool.go @@ -6,9 +6,9 @@ import ( "time" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/events" "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/states" "github.com/spiral/roadrunner/v2/pkg/worker" "github.com/spiral/roadrunner/v2/tools" ) @@ -144,7 +144,7 @@ func (sp *supervised) control() { workers := sp.pool.Workers() for i := 0; i < len(workers); i++ { - if workers[i].State().Value() == internal.StateInvalid { + if workers[i].State().Value() == states.StateInvalid { continue } @@ -177,7 +177,7 @@ func (sp *supervised) control() { // firs we check maxWorker idle if sp.cfg.IdleTTL != 0 { // then check for the worker state - if workers[i].State().Value() != internal.StateReady { + if workers[i].State().Value() != states.StateReady { continue } |