diff --git a/pkg/queue/breaker.go b/pkg/queue/breaker.go index 0d89e65722d7..79b78a37cd62 100644 --- a/pkg/queue/breaker.go +++ b/pkg/queue/breaker.go @@ -26,8 +26,6 @@ import ( ) var ( - // ErrRelease indicates that release was called more often than acquire. - ErrRelease = errors.New("semaphore release error: returned tokens must be <= acquired tokens") // ErrRequestQueueFull indicates the breaker queue depth was exceeded. ErrRequestQueueFull = errors.New("pending request queue full") ) @@ -135,7 +133,7 @@ func (b *Breaker) Reserve(ctx context.Context) (func(), bool) { // Maybe conditionally executes thunk based on the Breaker concurrency // and queue parameters. If the concurrency limit and queue capacity are // already consumed, Maybe returns immediately without calling thunk. If -// the thunk was executed, Maybe returns true, else false. +// the thunk was executed, Maybe returns nil, else error. func (b *Breaker) Maybe(ctx context.Context, thunk func()) error { if !b.tryAcquirePending() { return ErrRequestQueueFull diff --git a/pkg/queue/breaker_test.go b/pkg/queue/breaker_test.go index 5a6539fce39d..1fcfe2e86b9d 100644 --- a/pkg/queue/breaker_test.go +++ b/pkg/queue/breaker_test.go @@ -125,13 +125,13 @@ func TestBreakerOverload(t *testing.T) { reqs.request() reqs.expectFailure(t) - // The remainer should succeed. + // The remainder should succeed. reqs.processSuccessfully(t) reqs.processSuccessfully(t) } func TestBreakerQueueing(t *testing.T) { - params := BreakerParams{QueueDepth: 2, MaxConcurrency: 1, InitialCapacity: 0} + params := BreakerParams{QueueDepth: 1, MaxConcurrency: 1, InitialCapacity: 0} b := NewBreaker(params) // Breaker capacity = 2 reqs := newRequestor(b)