MCPcopy Index your code
hub / github.com/gammazero/workerpool

github.com/gammazero/workerpool @v1.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.1 ↗ · + Follow
56 symbols 234 edges 6 files 28 documented · 50% 9 cross-repo links updated 7d agov1.2.1 · 2026-02-14★ 1,4573 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

workerpool

GoDoc Build Status Go Report Card codecov License

Concurrency limiting goroutine pool. Limits the concurrency of task execution, not the number of tasks queued. Never blocks submitting tasks, no matter how many tasks are queued.

If you need a worker pool that blocks when all workers are busy, see workers.

This implementation builds on ideas from the following:

  • http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang
  • http://nesv.github.io/golang/2014/02/25/worker-queues-in-go.html

Installation

To install this package, you need to setup your Go workspace. The simplest way to install the library is to run:

$ go get github.com/gammazero/workerpool

Example

package main

import (
    "fmt"
    "github.com/gammazero/workerpool"
)

func main() {
    wp := workerpool.New(2)
    requests := []string{"alpha", "beta", "gamma", "delta", "epsilon"}

    for _, r := range requests {
        wp.Submit(func() {
            fmt.Println("Handling request:", r)
        })
    }

    wp.StopWait()
}

Example wrapper function to show start and finish time of submitted function.

Usage Note

There is no upper limit on the number of tasks queued, other than the limits of system resources. If the number of inbound tasks is too many to even queue for pending processing, then the solution is outside the scope of workerpool. It should be solved by distributing workload over multiple systems, and/or storing input for pending processing in intermediate storage such as a file system, distributed message queue, etc.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 31
Method 21
Struct 3
FuncType 1

Languages

Go100%

Modules by API surface

workerpool_test.go26 symbols
workerpool.go17 symbols
pacer/pacer.go9 symbols
options.go3 symbols
pacer/pacer_test.go1 symbols

For agents

$ claude mcp add workerpool \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page