recovery

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilStore = errors.New("stale-job-recovery: store is required")

ErrNilStore is returned when NewStaleJobRecoveryTask is called with nil Store.

Functions

func MaybeCompleteRunIfAllReposTerminal

func MaybeCompleteRunIfAllReposTerminal(ctx context.Context, st store.Store, eventsService *events.Service, run store.Run) (bool, error)

MaybeCompleteRunIfAllReposTerminal completes the owning wave when all child runs are terminal.

func MaybeUpdateRunStatus

func MaybeUpdateRunStatus(
	ctx context.Context,
	st store.Store,
	runID domaintypes.RunID,
	attempt int32,
) (bool, error)

MaybeUpdateRunStatus derives and persists runs.status from job outcomes.

Types

type Options

type Options struct {
	Store          store.Store
	EventsService  *events.Service
	Interval       time.Duration
	NodeStaleAfter time.Duration
	Logger         *slog.Logger
	GitLabTokens   *gitlabtokens.Registry
}

Options configures stale running-job recovery task behavior.

type RunAttemptReconcileEval

type RunAttemptReconcileEval struct {
	ShouldUpdate bool
	Status       domaintypes.RunStatus
	LastJob      *store.Job
}

RunAttemptReconcileEval is the pure evaluation result for run-attempt completion.

func EvaluateRunAttemptTerminalStatus

func EvaluateRunAttemptTerminalStatus(jobs []store.Job) (RunAttemptReconcileEval, error)

EvaluateRunAttemptTerminalStatus determines whether runs.status can be finalized.

type StaleJobRecoveryTask

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

StaleJobRecoveryTask scans for stale Running jobs and reconciles run/wave state.

func NewStaleJobRecoveryTask

func NewStaleJobRecoveryTask(opts Options) (*StaleJobRecoveryTask, error)

NewStaleJobRecoveryTask constructs a stale recovery task.

func (*StaleJobRecoveryTask) Interval

func (t *StaleJobRecoveryTask) Interval() time.Duration

Interval returns how often the recovery cycle should run.

func (*StaleJobRecoveryTask) Name

func (t *StaleJobRecoveryTask) Name() string

Name returns the task name for the scheduler.

func (*StaleJobRecoveryTask) Run

Run executes one stale-job recovery cycle.

Jump to

Keyboard shortcuts

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