worker

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobEventCallback added in v1.1.0

type JobEventCallback func(ctx context.Context, event domain.WebhookEvent)

JobEventCallback is called when a job event occurs

type MetricsCallback added in v1.1.0

type MetricsCallback func(jobType, status string, duration time.Duration)

MetricsCallback is called to report job metrics

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool manages a pool of workers for executing jobs

func NewPool

func NewPool(workers int, repo repository.Repository, registry *domain.JobRegistry) *Pool

NewPool creates a new worker pool

func (*Pool) CancelJob

func (p *Pool) CancelJob(ctx context.Context, jobID string) error

CancelJob cancels a running job

func (*Pool) GetStatus

func (p *Pool) GetStatus(ctx context.Context) *domain.WorkerStatus

GetStatus returns the current status of the worker pool

func (*Pool) SetJobEventCallback added in v1.1.0

func (p *Pool) SetJobEventCallback(callback JobEventCallback)

SetJobEventCallback sets the callback for job events (used for webhooks)

func (*Pool) SetLogRetention added in v1.1.0

func (p *Pool) SetLogRetention(days int)

SetLogRetention configures log retention cleanup

func (*Pool) SetMetricsCallback added in v1.1.0

func (p *Pool) SetMetricsCallback(callback MetricsCallback)

SetMetricsCallback sets the callback for job metrics

func (*Pool) Start

func (p *Pool) Start(ctx context.Context) error

Start starts the worker pool

func (*Pool) Stop

func (p *Pool) Stop(ctx context.Context) error

Stop stops the worker pool gracefully

Jump to

Keyboard shortcuts

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