summaryrefslogtreecommitdiff
path: root/pkg/worker_watcher
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-02 19:17:03 +0300
committerValery Piashchynski <[email protected]>2021-02-02 19:17:03 +0300
commit2bdf7fafa73cabf7cf63657a6b58f2a423ae0fcd (patch)
treefe5efc14a18f78218816a2bc7a2e19ee95642714 /pkg/worker_watcher
parent68becf8c58daec426f94513cf444061c199194d7 (diff)
Move worker states out of internal
Diffstat (limited to 'pkg/worker_watcher')
-rw-r--r--pkg/worker_watcher/stack.go4
-rwxr-xr-xpkg/worker_watcher/worker_watcher.go8
2 files changed, 6 insertions, 6 deletions
diff --git a/pkg/worker_watcher/stack.go b/pkg/worker_watcher/stack.go
index d76f4d8f..55034e41 100644
--- a/pkg/worker_watcher/stack.go
+++ b/pkg/worker_watcher/stack.go
@@ -5,7 +5,7 @@ import (
"sync"
"time"
- "github.com/spiral/roadrunner/v2/internal"
+ "github.com/spiral/roadrunner/v2/pkg/states"
"github.com/spiral/roadrunner/v2/pkg/worker"
)
@@ -129,7 +129,7 @@ func (stack *Stack) Destroy(ctx context.Context) {
stack.mutex.Lock()
for i := 0; i < len(stack.workers); i++ {
// set state for the stack in the stack (unused at the moment)
- stack.workers[i].State().Set(internal.StateDestroyed)
+ stack.workers[i].State().Set(states.StateDestroyed)
// kill the worker
_ = stack.workers[i].Kill()
}
diff --git a/pkg/worker_watcher/worker_watcher.go b/pkg/worker_watcher/worker_watcher.go
index 753b61ee..cf2e1eb7 100755
--- a/pkg/worker_watcher/worker_watcher.go
+++ b/pkg/worker_watcher/worker_watcher.go
@@ -5,8 +5,8 @@ import (
"sync"
"github.com/spiral/errors"
- "github.com/spiral/roadrunner/v2/internal"
"github.com/spiral/roadrunner/v2/pkg/events"
+ "github.com/spiral/roadrunner/v2/pkg/states"
"github.com/spiral/roadrunner/v2/pkg/worker"
)
@@ -49,7 +49,7 @@ func (ww *workerWatcher) GetFreeWorker(ctx context.Context) (worker.SyncWorker,
// handle worker remove state
// in this state worker is destroyed by supervisor
- if w != nil && w.State().Value() == internal.StateRemove {
+ if w != nil && w.State().Value() == states.StateRemove {
err := ww.RemoveWorker(w)
if err != nil {
return nil, err
@@ -102,7 +102,7 @@ func (ww *workerWatcher) RemoveWorker(wb worker.SyncWorker) error {
pid := wb.Pid()
if ww.stack.FindAndRemoveByPid(pid) {
- wb.State().Set(internal.StateRemove)
+ wb.State().Set(states.StateRemove)
err := wb.Kill()
if err != nil {
return errors.E(op, err)
@@ -142,7 +142,7 @@ func (ww *workerWatcher) wait(w worker.BaseProcess) {
})
}
- if w.State().Value() == internal.StateDestroyed {
+ if w.State().Value() == states.StateDestroyed {
// worker was manually destroyed, no need to replace
ww.events.Push(events.PoolEvent{Event: events.EventWorkerDestruct, Payload: w})
return