MCPcopy Index your code
hub / github.com/cortexproject/cortex / NewWorkerPool

Function NewWorkerPool

pkg/util/worker_pool.go:43–59  ·  view source on GitHub ↗
(name string, numWorkers int, reg prometheus.Registerer)

Source from the content-addressed store, hash-verified

41}
42
43func NewWorkerPool(name string, numWorkers int, reg prometheus.Registerer) AsyncExecutor {
44 wp := &workerPoolExecutor{
45 serverWorkerChannel: make(chan func()),
46 fallbackTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{
47 Namespace: "cortex",
48 Name: "worker_pool_fallback_total",
49 Help: "The total number additional go routines that needed to be created to run jobs.",
50 ConstLabels: prometheus.Labels{"name": name},
51 }),
52 }
53
54 for range numWorkers {
55 go wp.run()
56 }
57
58 return wp
59}
60
61func (s *workerPoolExecutor) Stop() {
62 s.closeOnce.Do(func() {

Calls 1

runMethod · 0.95