summaryrefslogtreecommitdiff
path: root/pkg/pool/static_pool.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-24 00:12:05 +0300
committerValery Piashchynski <[email protected]>2021-02-24 00:12:05 +0300
commite684ac16035bed9a4c09677b0db3b33477955dc9 (patch)
tree0d226eb8ad9730ede1f7cd80b5f7b44d1fb23b0a /pkg/pool/static_pool.go
parent18a097292a567fccdd02304ff236bf78d769965d (diff)
Fix pool behavior, update tests
Diffstat (limited to 'pkg/pool/static_pool.go')
-rwxr-xr-xpkg/pool/static_pool.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go
index f1b20bb9..0617cbc0 100755
--- a/pkg/pool/static_pool.go
+++ b/pkg/pool/static_pool.go
@@ -168,16 +168,16 @@ func (sp *StaticPool) Exec(p payload.Payload) (payload.Payload, error) {
}
// Be careful, sync with pool.Exec method
-func (sp *StaticPool) ExecWithContext(ctx context.Context, p payload.Payload) (payload.Payload, error) {
+func (sp *StaticPool) execWithTTL(ctx context.Context, p payload.Payload) (payload.Payload, error) {
const op = errors.Op("static_pool_exec_with_context")
- ctxGetFree, cancel := context.WithTimeout(ctx, sp.cfg.AllocateTimeout)
+ ctxAlloc, cancel := context.WithTimeout(ctx, sp.cfg.AllocateTimeout)
defer cancel()
- w, err := sp.getWorker(ctxGetFree, op)
+ w, err := sp.getWorker(ctxAlloc, op)
if err != nil {
return payload.Payload{}, errors.E(op, err)
}
- rsp, err := w.(worker.SyncWorker).ExecWithTimeout(ctx, p)
+ rsp, err := w.(worker.SyncWorker).ExecWithTTL(ctx, p)
if err != nil {
return sp.err_encoder(err, w)
}
@@ -185,7 +185,7 @@ func (sp *StaticPool) ExecWithContext(ctx context.Context, p payload.Payload) (p
// worker want's to be terminated
if len(rsp.Body) == 0 && toString(rsp.Context) == StopRequest {
sp.stopWorker(w)
- return sp.ExecWithContext(ctx, p)
+ return sp.execWithTTL(ctx, p)
}
err = sp.checkMaxJobs(w)