summaryrefslogtreecommitdiff
path: root/pkg/worker
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/worker')
-rwxr-xr-xpkg/worker/state.go3
-rwxr-xr-xpkg/worker/sync_worker.go4
-rwxr-xr-xpkg/worker/worker.go1
3 files changed, 5 insertions, 3 deletions
diff --git a/pkg/worker/state.go b/pkg/worker/state.go
index 176e151b..502f8199 100755
--- a/pkg/worker/state.go
+++ b/pkg/worker/state.go
@@ -27,6 +27,9 @@ const (
// State of worker, when no need to allocate new one
StateDestroyed
+ // State of worker, when it reached executions limit
+ StateMaxJobsReached
+
// StateStopped - process has been terminated.
StateStopped
diff --git a/pkg/worker/sync_worker.go b/pkg/worker/sync_worker.go
index ac987c14..7a1f3131 100755
--- a/pkg/worker/sync_worker.go
+++ b/pkg/worker/sync_worker.go
@@ -44,7 +44,7 @@ func (tw *SyncWorkerImpl) Exec(p payload.Payload) (payload.Payload, error) {
rsp, err := tw.execPayload(p)
if err != nil {
// just to be more verbose
- if errors.Is(errors.SoftJob, err) == false {
+ if errors.Is(errors.SoftJob, err) == false { //nolint:gosimple
tw.process.State().Set(StateErrored)
tw.process.State().RegisterExec()
}
@@ -91,7 +91,7 @@ func (tw *SyncWorkerImpl) ExecWithTTL(ctx context.Context, p payload.Payload) (p
rsp, err := tw.execPayload(p)
if err != nil {
// just to be more verbose
- if errors.Is(errors.SoftJob, err) == false {
+ if errors.Is(errors.SoftJob, err) == false { //nolint:gosimple
tw.process.State().Set(StateErrored)
tw.process.State().RegisterExec()
}
diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go
index 0f7ab755..b04e1363 100755
--- a/pkg/worker/worker.go
+++ b/pkg/worker/worker.go
@@ -46,7 +46,6 @@ type Process struct {
// InitBaseWorker creates new Process over given exec.cmd.
func InitBaseWorker(cmd *exec.Cmd, options ...Options) (*Process, error) {
- const op = errors.Op("init_base_worker")
if cmd.Process != nil {
return nil, fmt.Errorf("can't attach to running process")
}