summaryrefslogtreecommitdiff
path: root/pkg/worker
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-05 01:07:26 +0300
committerValery Piashchynski <[email protected]>2021-02-05 01:07:26 +0300
commit5e012c6f2c822858b63638325804524250992a42 (patch)
tree6832f8c5079c098d001792071b03d5ca23f22374 /pkg/worker
parentd629f08408a4478aaba90079a4e37ab69cfc12ef (diff)
handle worker state before sending to the exec
Diffstat (limited to 'pkg/worker')
-rwxr-xr-xpkg/worker/state.go9
-rwxr-xr-xpkg/worker/worker.go11
2 files changed, 10 insertions, 10 deletions
diff --git a/pkg/worker/state.go b/pkg/worker/state.go
index 54f76c09..c5d70a21 100755
--- a/pkg/worker/state.go
+++ b/pkg/worker/state.go
@@ -4,6 +4,7 @@ import (
"sync/atomic"
)
+// SYNC WITH worker_watcher.GET
const (
// StateInactive - no associated process
StateInactive int64 = iota
@@ -59,10 +60,18 @@ func (s *StateImpl) String() string {
return "working"
case StateInvalid:
return "invalid"
+ case StateStopping:
+ return "stopping"
case StateStopped:
return "stopped"
+ case StateKilling:
+ return "killing"
case StateErrored:
return "errored"
+ case StateDestroyed:
+ return "destroyed"
+ case StateRemove:
+ return "remove"
}
return "undefined"
diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go
index f7e8008f..c1e56f3a 100755
--- a/pkg/worker/worker.go
+++ b/pkg/worker/worker.go
@@ -15,15 +15,6 @@ import (
"go.uber.org/multierr"
)
-const (
- // WaitDuration - for how long error buffer should attempt to aggregate error messages
- // before merging output together since lastError update (required to keep error update together).
- WaitDuration = 25 * time.Millisecond
-
- // ReadBufSize used to make a slice with specified length to read from stderr
- ReadBufSize = 10240 // Kb
-)
-
type Options func(p *Process)
// Process - supervised process with api over goridge.Relay.
@@ -201,7 +192,7 @@ func (w *Process) Stop() error {
err = multierr.Append(err, internal.SendControl(w.relay, &internal.StopCommand{Stop: true}))
if err != nil {
w.state.Set(StateKilling)
- return multierr.Append(err, w.cmd.Process.Kill())
+ return multierr.Append(err, w.cmd.Process.Signal(os.Kill))
}
w.state.Set(StateStopped)
return nil