diff options
author | Valery Piashchynski <[email protected]> | 2021-02-02 19:30:00 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-02 19:30:00 +0300 |
commit | 20a1a5d2eb26090e0eef0e6772330ee2a52526fa (patch) | |
tree | c282e18c20029f60a798576cb4fe47d2762ffba0 /pkg/worker/sync_worker.go | |
parent | 36f01dc035f42115fcfd3b77dc5df3098382cd9f (diff) | |
parent | 2bdf7fafa73cabf7cf63657a6b58f2a423ae0fcd (diff) |
Merge pull request #522 from spiral/fix/named_loggerv2.0.0-beta.22
bug(logger): Incorrect parsing of nested log levels
Diffstat (limited to 'pkg/worker/sync_worker.go')
-rwxr-xr-x | pkg/worker/sync_worker.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/pkg/worker/sync_worker.go b/pkg/worker/sync_worker.go index 1a0393fb..696fbdb7 100755 --- a/pkg/worker/sync_worker.go +++ b/pkg/worker/sync_worker.go @@ -10,6 +10,7 @@ import ( "github.com/spiral/goridge/v3/pkg/frame" "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/states" "go.uber.org/multierr" ) @@ -49,25 +50,25 @@ func (tw *SyncWorkerImpl) Exec(p payload.Payload) (payload.Payload, error) { return payload.Payload{}, errors.E(op, errors.Str("payload can not be empty")) } - if tw.process.State().Value() != internal.StateReady { + if tw.process.State().Value() != states.StateReady { return payload.Payload{}, errors.E(op, errors.Errorf("Process is not ready (%s)", tw.process.State().String())) } // set last used time tw.process.State().SetLastUsed(uint64(time.Now().UnixNano())) - tw.process.State().Set(internal.StateWorking) + tw.process.State().Set(states.StateWorking) rsp, err := tw.execPayload(p) if err != nil { // just to be more verbose if errors.Is(errors.SoftJob, err) == false { - tw.process.State().Set(internal.StateErrored) + tw.process.State().Set(states.StateErrored) tw.process.State().RegisterExec() } return payload.Payload{}, err } - tw.process.State().Set(internal.StateReady) + tw.process.State().Set(states.StateReady) tw.process.State().RegisterExec() return rsp, nil @@ -92,7 +93,7 @@ func (tw *SyncWorkerImpl) ExecWithTimeout(ctx context.Context, p payload.Payload return } - if tw.process.State().Value() != internal.StateReady { + if tw.process.State().Value() != states.StateReady { c <- wexec{ payload: payload.Payload{}, err: errors.E(op, errors.Errorf("Process is not ready (%s)", tw.process.State().String())), @@ -102,13 +103,13 @@ func (tw *SyncWorkerImpl) ExecWithTimeout(ctx context.Context, p payload.Payload // set last used time tw.process.State().SetLastUsed(uint64(time.Now().UnixNano())) - tw.process.State().Set(internal.StateWorking) + tw.process.State().Set(states.StateWorking) rsp, err := tw.execPayload(p) if err != nil { // just to be more verbose if errors.Is(errors.SoftJob, err) == false { - tw.process.State().Set(internal.StateErrored) + tw.process.State().Set(states.StateErrored) tw.process.State().RegisterExec() } c <- wexec{ @@ -118,7 +119,7 @@ func (tw *SyncWorkerImpl) ExecWithTimeout(ctx context.Context, p payload.Payload return } - tw.process.State().Set(internal.StateReady) + tw.process.State().Set(states.StateReady) tw.process.State().RegisterExec() c <- wexec{ |