diff options
Diffstat (limited to 'modules/queue/manager.go')
-rw-r--r-- | modules/queue/manager.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/queue/manager.go b/modules/queue/manager.go index 73c57540be..bba2c54ad2 100644 --- a/modules/queue/manager.go +++ b/modules/queue/manager.go @@ -84,6 +84,8 @@ type ManagedPool interface { BoostWorkers() int // SetPoolSettings sets the user updatable settings for the pool SetPoolSettings(maxNumberOfWorkers, boostWorkers int, timeout time.Duration) + // NumberInQueue returns the total number of items in the pool + NumberInQueue() int64 // Done returns a channel that will be closed when the Pool's baseCtx is closed Done() <-chan struct{} } @@ -427,6 +429,14 @@ func (q *ManagedQueue) SetPoolSettings(maxNumberOfWorkers, boostWorkers int, tim } } +// NumberInQueue returns the number of items in the queue +func (q *ManagedQueue) NumberInQueue() int64 { + if pool, ok := q.Managed.(ManagedPool); ok { + return pool.NumberInQueue() + } + return -1 +} + func (l ManagedQueueList) Len() int { return len(l) } |