worker

package
v0.8.22 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSourceBacklogStalled = errors.New("source backlog stalled")

ErrSourceBacklogStalled identifies a source worker that found eligible work but exhausted a bounded pass without successful durable advancement. A retryable failure may still move a candidate into deferred retry state; the worker treats repeated failure-only batches as stalled after its bound. The sentinel is intentionally independent of provider error text so the scheduled notification classifier can use the existing sources-stage type.

Functions

This section is empty.

Types

type SourceBacklogFunc

type SourceBacklogFunc func(context.Context) (store.BacklogStats, error)

type SourceBacklogStalledError added in v0.8.21

type SourceBacklogStalledError struct {
	Attempted              int
	Succeeded              int
	Errors                 int
	SummaryRetriesDeferred int
	FinalBacklog           store.BacklogStats
}

func (*SourceBacklogStalledError) Error added in v0.8.21

func (e *SourceBacklogStalledError) Error() string

func (*SourceBacklogStalledError) Unwrap added in v0.8.21

func (e *SourceBacklogStalledError) Unwrap() error

type SourceOptions

type SourceOptions struct {
	Watch         bool
	PollInterval  time.Duration
	IdleExitAfter time.Duration
	MaxCycles     int
	MaxSources    int
	Logger        *slog.Logger
	Now           func() time.Time
	Sleep         func(context.Context, time.Duration) error
}

type SourceRunFunc

type SourceRunFunc func(context.Context, int) (sourceenrich.Stats, error)

type SourceStats

type SourceStats struct {
	Cycles                 int                `json:"cycles"`
	WorkCycles             int                `json:"work_cycles"`
	IdlePolls              int                `json:"idle_polls"`
	SourcesQueued          int                `json:"sources_queued"`
	SourcesExtracted       int                `json:"sources_extracted"`
	SourcesSummarized      int                `json:"sources_summarized"`
	SourcesRendered        int                `json:"sources_rendered"`
	SourcesUnchanged       int                `json:"sources_unchanged"`
	SummaryRetriesDeferred int                `json:"summary_retries_deferred"`
	Errors                 int                `json:"errors"`
	StoppedReason          string             `json:"stopped_reason"`
	FinalBacklog           store.BacklogStats `json:"final_backlog"`
	StartedAt              time.Time          `json:"started_at,omitempty"`
	CompletedAt            time.Time          `json:"completed_at,omitempty"`
	Duration               time.Duration      `json:"duration"`
	LastWorkCompleted      time.Time          `json:"last_work_completed,omitempty"`
	LastIdleObservedAt     time.Time          `json:"last_idle_observed_at,omitempty"`
}

func RunSources

func RunSources(ctx context.Context, backlogFn SourceBacklogFunc, runFn SourceRunFunc, opts SourceOptions) (SourceStats, error)

Jump to

Keyboard shortcuts

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