summaryrefslogtreecommitdiff
path: root/static_pool.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-09 14:21:21 +0300
committerValery Piashchynski <[email protected]>2020-11-09 14:21:21 +0300
commite3a1669c8168320318291325f70ca35e2ab2eec3 (patch)
treef14875ecb4a86805226812108efcab72898b6125 /static_pool.go
parent9fbe7726dd55cfedda724b7644e1b6bf7c1a6cb4 (diff)
New tests, remove errors.go
Diffstat (limited to 'static_pool.go')
-rwxr-xr-xstatic_pool.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/static_pool.go b/static_pool.go
index 66dac7c3..ee81fd39 100755
--- a/static_pool.go
+++ b/static_pool.go
@@ -118,9 +118,9 @@ func (sp *StaticPool) Exec(p Payload) (Payload, error) {
rsp, err := sw.Exec(p)
if err != nil {
// soft job errors are allowed
- if _, jobError := err.(ExecError); jobError {
+ if errors.Is(errors.Exec, err) {
if sp.cfg.MaxJobs != 0 && w.State().NumExecs() >= sp.cfg.MaxJobs {
- err := sp.ww.AllocateNew(bCtx)
+ err = sp.ww.AllocateNew(bCtx)
if err != nil {
sp.events.Push(PoolEvent{Event: EventPoolError, Payload: err})
}
@@ -135,6 +135,7 @@ func (sp *StaticPool) Exec(p Payload) (Payload, error) {
}
return EmptyPayload, err
+
}
sw.State().Set(StateInvalid)
@@ -199,9 +200,9 @@ func (sp *StaticPool) ExecWithContext(ctx context.Context, rqs Payload) (Payload
rsp, err := sw.ExecWithContext(ctx, rqs)
if err != nil {
// soft job errors are allowed
- if _, jobError := err.(ExecError); jobError {
+ if errors.Is(errors.Exec, err) {
if sp.cfg.MaxJobs != 0 && w.State().NumExecs() >= sp.cfg.MaxJobs {
- err := sp.ww.AllocateNew(bCtx)
+ err = sp.ww.AllocateNew(bCtx)
if err != nil {
sp.events.Push(PoolEvent{Event: EventPoolError, Payload: err})
}