worker

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

internal/worker/pool.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessFunc

type ProcessFunc func(ctx context.Context, repo model.Repo) (*model.RepoStats, error)

ProcessFunc processes a single repository and returns its stats.

type ProgressFunc

type ProgressFunc func(completed, total int, repo model.Repo)

ProgressFunc is called after each repository is processed.

type Result

type Result struct {
	Repo  model.Repo
	Stats *model.RepoStats
	Err   error
}

Result holds the outcome of processing a single repository.

func Run

func Run(ctx context.Context, repos []model.Repo, concurrency int, process ProcessFunc) []Result

Run processes repos concurrently using a bounded worker pool.

func RunWithProgress

func RunWithProgress(ctx context.Context, repos []model.Repo, concurrency int, process ProcessFunc, onProgress ProgressFunc) []Result

RunWithProgress processes repos concurrently with an optional progress callback.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL