diff options
Diffstat (limited to 'internal/workers')
| -rw-r--r-- | internal/workers/worker_fn.go | 5 | ||||
| -rw-r--r-- | internal/workers/worker_msg.go | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/internal/workers/worker_fn.go b/internal/workers/worker_fn.go index c57fcfe88..5d1b5e56b 100644 --- a/internal/workers/worker_fn.go +++ b/internal/workers/worker_fn.go @@ -85,6 +85,11 @@ func (p *FnWorkerPool) Stop() { p.workers = p.workers[:0] } +// Len returns number of currently active workers. +func (p *FnWorkerPool) Len() int { + return len(p.workers) +} + // FnWorker wraps a queue.SimpleQueue{} which // it feeds from to provide it with function // tasks to execute. It does so in a single diff --git a/internal/workers/worker_msg.go b/internal/workers/worker_msg.go index e038fda02..65b9adb82 100644 --- a/internal/workers/worker_msg.go +++ b/internal/workers/worker_msg.go @@ -96,6 +96,11 @@ func (p *MsgWorkerPool[T]) Stop() { p.workers = p.workers[:0] } +// Len returns number of currently active workers. +func (p *MsgWorkerPool[T]) Len() int { + return len(p.workers) +} + // MsgWorker wraps a processing function to // feed from a queue.StructQueue{} for messages // to process. It does so in a single goroutine |
