summaryrefslogtreecommitdiff
path: root/internal/workers/worker_msg.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-08-20 18:14:00 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-08-20 18:14:00 +0200
commit1144ac037fcb4fd7ec9729c4e0846c6f7fe9a2ed (patch)
tree22db33e09ffd7c2d4884c61b7776c0ca32344e98 /internal/workers/worker_msg.go
parent[bugfix] when clearing media metadata, copy all streams not just first (#4375) (diff)
downloadgotosocial-1144ac037fcb4fd7ec9729c4e0846c6f7fe9a2ed.tar.xz
[feature] add metrics for worker counts, and worker queue sizes (#4387)
should help to debug https://codeberg.org/superseriousbusiness/gotosocial/issues/4309 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4387 Reviewed-by: Daenney <daenney@noreply.codeberg.org> Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/workers/worker_msg.go')
-rw-r--r--internal/workers/worker_msg.go5
1 files changed, 5 insertions, 0 deletions
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