Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Adds better error when there are timeouts in resource pools
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Chacon <[email protected]>
  • Loading branch information
rafael committed Dec 9, 2020
1 parent adc03bf commit 3018928
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/pools/resource_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ import (
"vitess.io/vitess/go/sync2"
"vitess.io/vitess/go/timer"
"vitess.io/vitess/go/trace"
"vitess.io/vitess/go/vt/vterrors"

vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
)

var (
// ErrClosed is returned if ResourcePool is used when it's closed.
ErrClosed = errors.New("resource pool is closed")

// ErrTimeout is returned if a resource get times out.
ErrTimeout = errors.New("resource pool timed out")
ErrTimeout = vterrors.New(vtrpcpb.Code_DEADLINE_EXCEEDED, "resource pool timed out")

// ErrCtxTimeout is returned if a ctx is already expired by the time the resource pool is used
ErrCtxTimeout = errors.New("resource pool context already expired")
ErrCtxTimeout = vterrors.New(vtrpcpb.Code_DEADLINE_EXCEEDED, "resource pool context already expired")

prefillTimeout = 30 * time.Second
)
Expand Down

0 comments on commit 3018928

Please sign in to comment.