diff options
author | Valery Piashchynski <[email protected]> | 2021-01-19 18:10:39 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-19 18:10:39 +0300 |
commit | 0ff05b2732b4fd0783f959c94c54d7e39169f979 (patch) | |
tree | f50aa894ea4e5b402332f7f4a13b8c50ebb09126 /pkg/pool/static_pool.go | |
parent | 75ebbaac89ce8ebc3ab8de47b16e137844cfcd8a (diff) | |
parent | d8e42927b63a0b102ce10d465a10d64bb6c02e22 (diff) |
Merge pull request #487 from spiral/refactor/server_log_messagesv2.0.0-beta9
refactor(errors, logs): Uniform all errors operations, Update server log level of the server log messages
Diffstat (limited to 'pkg/pool/static_pool.go')
-rwxr-xr-x | pkg/pool/static_pool.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go index 7cac7b4d..438f936f 100755 --- a/pkg/pool/static_pool.go +++ b/pkg/pool/static_pool.go @@ -54,7 +54,7 @@ type StaticPool struct { // Initialize creates new worker pool and task multiplexer. StaticPool will initiate with one worker. func Initialize(ctx context.Context, cmd Command, factory worker.Factory, cfg Config, options ...Options) (pool.Pool, error) { - const op = errors.Op("static pool initialize") + const op = errors.Op("static_pool_initialize") if factory == nil { return nil, errors.E(op, errors.Str("no factory initialized")) } @@ -174,7 +174,7 @@ func (sp *StaticPool) Exec(p payload.Payload) (payload.Payload, error) { } func (sp *StaticPool) ExecWithContext(ctx context.Context, rqs payload.Payload) (payload.Payload, error) { - const op = errors.Op("exec with context") + const op = errors.Op("static_pool_exec_with_context") ctxGetFree, cancel := context.WithTimeout(ctx, sp.cfg.AllocateTimeout) defer cancel() w, err := sp.getWorker(ctxGetFree, op) @@ -233,6 +233,10 @@ func (sp *StaticPool) Destroy(ctx context.Context) { func defaultErrEncoder(sp *StaticPool) ErrorEncoder { return func(err error, w worker.BaseProcess) (payload.Payload, error) { const op = errors.Op("error encoder") + // just push event if on any stage was timeout error + if errors.Is(errors.ExecTTL, err) { + sp.events.Push(events.PoolEvent{Event: events.EventExecTTL, Payload: errors.E(op, err)}) + } // soft job errors are allowed if errors.Is(errors.SoftJob, err) { if sp.cfg.MaxJobs != 0 && w.State().NumExecs() >= sp.cfg.MaxJobs { |