proxy.golang.org : github.com/go-pkgz/pool
Package pool provides a simple worker pool implementation with a single stage only. It allows submitting tasks to be processed in parallel by a number of workers. The package supports both stateless and stateful workers through two distinct constructors: Worker Types: The package provides a simple Worker interface that can be implemented in two ways: 1. Direct implementation for complex stateful workers: 2. Function adapter for simple stateless workers: Basic Usage: For stateless operations (like HTTP requests, parsing operations, etc.): For stateful operations (like database connections, file handles, etc.): Features: Advanced Features: Batching: Chunked distribution: Error handling: Metrics: The pool automatically tracks standard stats metrics (processed counts, errors, timings). Workers can also record additional custom metrics: Access metrics: Statistical metrics including: Access stats: Data Collection: For collecting results from workers, use the Collector: Results can be retrieved either through iteration: Or by collecting all at once: Middleware Support: The pool supports middleware pattern similar to HTTP middleware in Go. Middleware can be used to add functionality like retries, timeouts, metrics, or error handling: Multiple middleware can be chained, and they execute in the same order as provided:
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/go-pkgz/pool
Keywords:
concurrency
, concurrent-programming
, go
, golang
, parallel
, pool
License: MIT
Latest release: 3 months ago
First release: 3 months ago
Namespace: github.com/go-pkgz
Stars: 10 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Funding links: https://github.com/sponsors/umputun
Last synced: about 22 hours ago