summaryrefslogtreecommitdiff
path: root/pkg/worker_watcher
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-23 23:35:44 +0300
committerValery Piashchynski <[email protected]>2020-12-23 23:35:44 +0300
commite78c13d93a729a9008f283aa3db6910f3e833165 (patch)
treee633604841b80c42b195388429dc12349e4b9d1f /pkg/worker_watcher
parentc21fe8e2f99c3cb8e3c1482e35f2efa0e914c337 (diff)
Initial implementation of serve, reset, workers commands for the RR2
Diffstat (limited to 'pkg/worker_watcher')
-rwxr-xr-xpkg/worker_watcher/worker_watcher.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/pkg/worker_watcher/worker_watcher.go b/pkg/worker_watcher/worker_watcher.go
index 55191ce6..39d334ba 100755
--- a/pkg/worker_watcher/worker_watcher.go
+++ b/pkg/worker_watcher/worker_watcher.go
@@ -128,6 +128,8 @@ func (stack *Stack) Destroy(ctx context.Context) {
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)
+ // kill the worker
+ _ = stack.workers[i].Kill()
}
stack.mutex.Unlock()
tt.Stop()
@@ -223,11 +225,6 @@ func (ww *workerWatcher) AllocateNew() error {
ww.stack.mutex.Unlock()
ww.PushWorker(sw)
- ww.events.Push(events.PoolEvent{
- Event: events.EventWorkerConstruct,
- Payload: sw,
- })
-
return nil
}
@@ -282,6 +279,7 @@ func (ww *workerWatcher) wait(w worker.BaseProcess) {
if w.State().Value() == internal.StateDestroyed {
// worker was manually destroyed, no need to replace
+ ww.events.Push(events.PoolEvent{Event: events.EventWorkerDestruct, Payload: w})
return
}