Skip to content

Releases: sangianpatrick/go-workerpool

v1.0.1 — CI & Tooling

Choose a tag to compare

@sangianpatrick sangianpatrick released this 23 May 14:00

What's Changed

Added

  • GitHub Actions CI with test, race detection, and 100% coverage gate
  • Security scanning (govulncheck + gosec)
  • Codecov integration for dynamic coverage badge
  • Go Reference, Go Report Card, and CI badges in README

Fixed

  • Bumped minimum Go version to 1.23 to resolve GO-2025-3750 (Windows-only stdlib vulnerability)

Documentation

  • Added doc comments to all exported types

Full Changelog: v1.0.0...v1.0.1

v1.0.0 — Stable Release

Choose a tag to compare

@sangianpatrick sangianpatrick released this 23 May 13:32

go-workerpool v1.0.0

First stable release of go-workerpool — a lightweight Go worker pool with non-blocking job submission, caller-controlled timeouts, and graceful shutdown.

Features

  • Configurable workers and queue — NumWorkers(n) and JobQueueSize(n)
  • Caller-controlled timeout — Submit(ctx, job) respects context deadlines
  • Graceful shutdown — Stop() drains all queued jobs with a live context before canceling
  • Lock-free close detection — uses atomic + recover (no mutex on hot path)
  • Error callback — OnError(fn) for observing failed jobs
  • Metrics hook — WithMetrics(m) interface for observability (processed/failed counts)
  • Queue monitoring — Len() returns current queue depth
  • Pluggable handler — implement Handler interface for custom job processing
  • Pluggable logger — WithLogger(l) or use default log.Printf
  • Idempotent Stop — safe to call multiple times

API

go
wp := workerpool.NewWorkerPool(
workerpool.NumWorkers(4),
workerpool.JobQueueSize(10),
workerpool.SetHandler(&MyHandler{}),
workerpool.OnError(func(job workerpool.Job, err error) { /* ... */ }),
)
wp.Start()

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
wp.Submit(ctx, workerpool.Job{ID: "task-1", Data: payload})

wp.Stop()

Examples

Requirements

  • Go 1.22+
  • Zero external dependencies