• v1.0.0 f07782d583

    Rene Nochebuena released this 2026-05-12 11:51:36 -06:00 | 0 commits to main since this release

    v1.0.0

    code.nochebuena.dev/go/worker

    Overview

    worker provides a fixed-size goroutine pool that receives background tasks via a
    buffered channel. It integrates with launcher for managed startup and graceful
    shutdown, and uses logz for structured logging. Tasks are plain
    func(ctx context.Context) error callables.

    v1.0.0 adds Len() int to Provider, bumps all micro-lib dependencies to v1,
    and commits the API as stable.

    What Changed Since v0.9.0

    New: Len() int on Provider

    type Provider interface {
        Dispatch(task Task) bool
        Len() int  // current number of queued tasks
    }
    

    Returns the number of tasks currently waiting in the buffer. Use it to observe
    backpressure depth or assert queue state in tests.

    Dependency updates

    • launcher bumped from v0.9.0 to v1.0.1
    • logz bumped from v0.9.0 to v1.0.1
    • Go directive bumped from 1.25 to 1.26

    Full API (stable)

    • Taskfunc(ctx context.Context) error
    • ConfigPoolSize, BufferSize, TaskTimeout, ShutdownTimeout
    • ProviderDispatch(Task) bool, Len() int
    • Component — embeds launcher.Component + Provider
    • New(logger, cfg) Component

    Installation

    go get code.nochebuena.dev/go/worker@v1.0.0
    

    Changelog

    See CHANGELOG.md.

    Downloads