Skip to content

mirkobrombin/go-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Worker

A compact worker pool for Go applications that want predictable task execution with graceful shutdown semantics.

Features

  • Fixed Worker Pool: Start a pool with a stable number of workers.
  • Graceful Shutdown: Stop accepting new tasks and wait for queued work to finish.
  • Context-Aware Tasks: Pass a shared context into each task function.
  • Small API Surface: Keep submission and shutdown logic easy to reason about.

Installation

go get github.com/mirkobrombin/go-worker

Quick Start

package main

import (
    "context"
    "fmt"

    "github.com/mirkobrombin/go-worker/pkg/worker"
)

func main() {
    pool := worker.NewPool(2)
    defer pool.Shutdown()

    pool.Submit(func(ctx context.Context) error {
        fmt.Println("working")
        return nil
    })
}

Documentation

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A compact worker pool for Go applications that want predictable task execution with graceful shutdown semantics.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages