Changes
2 changed files (+16/-0)
-
-
@@ -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) // Done returns a channel that will be closed when the Pool's baseCtx is closed Done() <-chan struct{} } // ManagedQueueList implements the sort.Interface
-
@@ -211,6 +213,15 @@ func (m *Manager) FlushAll(baseCtx context.Context, timeout time.Duration) errorcontinue } } if pool, ok := mq.Managed.(ManagedPool); ok { // No point into flushing pools when their base's ctx is already done. select { case <-pool.Done(): wg.Done() continue default: } } allEmpty = false if flushable, ok := mq.Managed.(Flushable); ok {
-
-
-
@@ -74,6 +74,11 @@ func NewWorkerPool(handle HandlerFunc, config WorkerPoolConfiguration) *WorkerPoreturn pool } // Done returns when this worker pool's base context has been cancelled func (p *WorkerPool) Done() <-chan struct{} { return p.baseCtx.Done() } // Push pushes the data to the internal channel func (p *WorkerPool) Push(data Data) { atomic.AddInt64(&p.numInQueue, 1)
-