scheduler

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: BSD-3-Clause Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const ActivitySweepJobName = "activity-sweep"
View Source
const (
	AnalyticsJobName = "analytics-heartbeat"
)
View Source
const AutoHealJobName = "auto-heal"
View Source
const DockerClientRefreshJobName = "docker-client-refresh"
View Source
const EventCleanupJobName = "event-cleanup"
View Source
const ExpiredSessionsCleanupJobName = "expired-sessions-cleanup"
View Source
const (
	PruningVolumeHelperJobName = "pruning-volume-helper"
)
View Source
const ScheduledPruneJobName = "scheduled-prune"
View Source
const VulnerabilityScanJobName = "vulnerability-scan"

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivitySweepJob added in v2.6.0

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

ActivitySweepJob periodically fails queued/running activities whose worker is no longer alive in this process, so a lost terminal write (crash, panic, dropped DB write) cannot leave an activity stuck in running forever. It is an internal job: it has no job_metadata entry and is invisible in the Jobs UI.

func NewActivitySweepJob added in v2.6.0

func NewActivitySweepJob(activityService *services.ActivityService) *ActivitySweepJob

func (*ActivitySweepJob) Name added in v2.6.0

func (j *ActivitySweepJob) Name() string

func (*ActivitySweepJob) Run added in v2.6.0

func (j *ActivitySweepJob) Run(ctx context.Context)

func (*ActivitySweepJob) Schedule added in v2.6.0

func (j *ActivitySweepJob) Schedule(_ context.Context) string

type AnalyticsJob

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

func NewAnalyticsJob

func NewAnalyticsJob(
	settingsService *services.SettingsService,
	kvService *services.KVService,
	httpClient *http.Client,
	cfg *config.Config,
) *AnalyticsJob

func (*AnalyticsJob) Name

func (j *AnalyticsJob) Name() string

func (*AnalyticsJob) Reschedule

func (j *AnalyticsJob) Reschedule(ctx context.Context) error

func (*AnalyticsJob) Run

func (j *AnalyticsJob) Run(ctx context.Context)

func (*AnalyticsJob) Schedule

func (j *AnalyticsJob) Schedule(_ context.Context) string

type AutoHealJob

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

func NewAutoHealJob

func NewAutoHealJob(
	dockerClientService *services.DockerClientService,
	settingsService *services.SettingsService,
	eventService *services.EventService,
	notificationService *services.NotificationService,
) *AutoHealJob

func (*AutoHealJob) CanRestartExported

func (j *AutoHealJob) CanRestartExported(containerID string, maxRestarts int, window time.Duration) bool

CanRestartExported exposes canRestart for testing.

func (*AutoHealJob) Name

func (j *AutoHealJob) Name() string

func (*AutoHealJob) RecordRestartAtExported

func (j *AutoHealJob) RecordRestartAtExported(containerID string, t time.Time)

RecordRestartAtExported records a restart at a specific time for testing.

func (*AutoHealJob) RecordRestartExported

func (j *AutoHealJob) RecordRestartExported(containerID string)

RecordRestartExported exposes recordRestart for testing.

func (*AutoHealJob) Reschedule

func (j *AutoHealJob) Reschedule(ctx context.Context) error

func (*AutoHealJob) ResetRestartTracking

func (j *AutoHealJob) ResetRestartTracking()

ResetRestartTracking clears all restart records (exported for testing).

func (*AutoHealJob) Run

func (j *AutoHealJob) Run(ctx context.Context)

func (*AutoHealJob) Schedule

func (j *AutoHealJob) Schedule(ctx context.Context) string

func (*AutoHealJob) ShouldSchedule

func (j *AutoHealJob) ShouldSchedule(ctx context.Context) bool

type AutoUpdateJob

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

func NewAutoUpdateJob

func NewAutoUpdateJob(updaterService *services.UpdaterService, settingsService *services.SettingsService) *AutoUpdateJob

func (*AutoUpdateJob) Name

func (j *AutoUpdateJob) Name() string

func (*AutoUpdateJob) Reschedule

func (j *AutoUpdateJob) Reschedule(ctx context.Context) error

func (*AutoUpdateJob) Run

func (j *AutoUpdateJob) Run(ctx context.Context)

func (*AutoUpdateJob) Schedule

func (j *AutoUpdateJob) Schedule(ctx context.Context) string

func (*AutoUpdateJob) ShouldSchedule

func (j *AutoUpdateJob) ShouldSchedule(ctx context.Context) bool

type DockerClientRefreshJob

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

DockerClientRefreshJob keeps the cached Docker client aligned with the daemon API version after daemon restarts or upgrades.

func NewDockerClientRefreshJob

func NewDockerClientRefreshJob(dockerClientService *services.DockerClientService, settingsService *services.SettingsService) *DockerClientRefreshJob

NewDockerClientRefreshJob creates the scheduled Docker client refresh job.

func (*DockerClientRefreshJob) Name

func (j *DockerClientRefreshJob) Name() string

func (*DockerClientRefreshJob) Run

func (*DockerClientRefreshJob) Schedule

func (j *DockerClientRefreshJob) Schedule(ctx context.Context) string

type EventCleanupJob

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

func NewEventCleanupJob

func NewEventCleanupJob(eventService *services.EventService, activityService *services.ActivityService, settingsService *services.SettingsService) *EventCleanupJob

func (*EventCleanupJob) Name

func (j *EventCleanupJob) Name() string

func (*EventCleanupJob) Reschedule

func (j *EventCleanupJob) Reschedule(ctx context.Context) error

func (*EventCleanupJob) Run

func (j *EventCleanupJob) Run(ctx context.Context)

func (*EventCleanupJob) Schedule

func (j *EventCleanupJob) Schedule(ctx context.Context) string

type ExpiredSessionsCleanupJob

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

func NewExpiredSessionsCleanupJob

func NewExpiredSessionsCleanupJob(sessionService *services.SessionService, settingsService *services.SettingsService) *ExpiredSessionsCleanupJob

func (*ExpiredSessionsCleanupJob) Name

func (*ExpiredSessionsCleanupJob) Reschedule

func (j *ExpiredSessionsCleanupJob) Reschedule(ctx context.Context) error

func (*ExpiredSessionsCleanupJob) Run

func (*ExpiredSessionsCleanupJob) Schedule

type FilesystemWatcherJob

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

func NewFilesystemWatcherJob

func NewFilesystemWatcherJob(
	projectService *services.ProjectService,
	templateService *services.TemplateService,
	settingsService *services.SettingsService,
	projectScanDepth int,
) *FilesystemWatcherJob

func RegisterFilesystemWatcherJob

func RegisterFilesystemWatcherJob(ctx context.Context, projectService *services.ProjectService, templateService *services.TemplateService, settingsService *services.SettingsService, projectScanDepth int) (*FilesystemWatcherJob, error)

func (*FilesystemWatcherJob) RestartProjectsWatcher

func (j *FilesystemWatcherJob) RestartProjectsWatcher(ctx context.Context) error

func (*FilesystemWatcherJob) RestartTemplatesWatcher

func (j *FilesystemWatcherJob) RestartTemplatesWatcher(ctx context.Context) error

func (*FilesystemWatcherJob) Start

func (j *FilesystemWatcherJob) Start(ctx context.Context) error

func (*FilesystemWatcherJob) Stop

func (j *FilesystemWatcherJob) Stop() error

type ImageUpdateWatcher added in v2.5.0

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

ImageUpdateWatcher continuously reconciles image update state after Docker image changes.

func NewImageUpdateWatcher added in v2.5.0

func NewImageUpdateWatcher(cfg *config.Config, imageUpdateService *services.ImageUpdateService, settingsService *services.SettingsService, environmentService *services.EnvironmentService, dockerService *services.DockerClientService, projectService *services.ProjectService) *ImageUpdateWatcher

NewImageUpdateWatcher constructs the image update watcher from the existing services.

func (*ImageUpdateWatcher) Name added in v2.5.0

func (w *ImageUpdateWatcher) Name() string

Name identifies the watcher in scheduler lifecycle logs.

func (*ImageUpdateWatcher) RefreshSchedule added in v2.5.0

func (w *ImageUpdateWatcher) RefreshSchedule()

RefreshSchedule wakes the scheduled-poll loop so it re-reads pollingInterval.

func (*ImageUpdateWatcher) RunNow added in v2.5.0

func (w *ImageUpdateWatcher) RunNow(ctx context.Context) error

RunNow performs the same full-host image scan used by automatic watcher triggers. It does not wait behind an active scan: a request during one returns ImageScanInProgressError immediately instead of parking (potentially forever, given the detached run-now context) on the single-flight gate. The triggered-scan loop waits and retries itself.

func (*ImageUpdateWatcher) Start added in v2.5.0

func (w *ImageUpdateWatcher) Start(ctx context.Context) error

Start subscribes to Docker image events, prepares project metadata, and runs scans until ctx is canceled.

func (*ImageUpdateWatcher) Trigger added in v2.5.0

func (w *ImageUpdateWatcher) Trigger()

Trigger queues an image scan without blocking the Docker event publisher.

type JobScheduler

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

func NewJobScheduler

func NewJobScheduler(ctx context.Context, location *time.Location) *JobScheduler

NewJobScheduler creates a new job scheduler with the specified timezone location. The location is used for interpreting cron expressions. If location is nil, UTC is used.

func (*JobScheduler) AddJob

func (js *JobScheduler) AddJob(ctx context.Context, job schedulertypes.Job) error

AddJob registers and schedules a job at runtime. It is an idempotent upsert: a replacement expression is validated before the existing entry is removed, then the replacement is installed without leaking a second live entry. Safe to call before or after StartScheduler.

func (*JobScheduler) GetJob

func (js *JobScheduler) GetJob(jobID string) mo.Option[schedulertypes.Job]

func (*JobScheduler) GetJobRuntimeState added in v2.4.0

func (js *JobScheduler) GetJobRuntimeState(jobID string) mo.Option[schedulertypes.JobRuntimeState]

GetJobRuntimeState returns the schedule currently installed for a registered job.

func (*JobScheduler) GetLocation

func (js *JobScheduler) GetLocation() *time.Location

GetLocation returns the timezone location used by the scheduler for cron expressions.

func (*JobScheduler) HasJob

func (js *JobScheduler) HasJob(jobID string) bool

HasJob reports whether a job with the given name is currently registered.

func (*JobScheduler) RegisterBusWatcher added in v2.5.0

func (js *JobScheduler) RegisterBusWatcher(watcher schedulertypes.BusWatcher, canRunManually bool)

RegisterBusWatcher starts a continuous event watcher on the scheduler lifecycle.

func (*JobScheduler) RegisterJob

func (js *JobScheduler) RegisterJob(job schedulertypes.Job)

RegisterJob records a static job to be scheduled when StartScheduler runs. Use AddJob for jobs added dynamically at runtime.

func (*JobScheduler) RemoveJob

func (js *JobScheduler) RemoveJob(ctx context.Context, jobName string)

RemoveJob unschedules and forgets a job by name. It is a no-op (not an error) when no job with that name is registered.

func (*JobScheduler) RescheduleJob

func (js *JobScheduler) RescheduleJob(ctx context.Context, job schedulertypes.Job) error

func (*JobScheduler) RunBusWatcherNow added in v2.5.0

func (js *JobScheduler) RunBusWatcherNow(ctx context.Context, watcherID string) error

RunBusWatcherNow runs a watcher through its serialized manual path.

func (*JobScheduler) StartScheduler

func (js *JobScheduler) StartScheduler()

func (*JobScheduler) Stop added in v2.6.0

func (js *JobScheduler) Stop(ctx context.Context) error

Stop stops the scheduler and waits for running jobs and bus watchers to finish. If ctx is canceled or reaches its deadline first, Stop returns ctx.Err().

type PruningVolumeHelperJob

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

PruningVolumeHelperJob periodically removes idle volume-browser helper containers. The run frequency is fixed (every 5 minutes); how stale a helper must be to be pruned is driven by the volumeBrowserHelperIdleTimeout setting.

func NewPruningVolumeHelperJob

func NewPruningVolumeHelperJob(volumeService *services.VolumeService, settingsService *services.SettingsService) *PruningVolumeHelperJob

func (*PruningVolumeHelperJob) Name

func (j *PruningVolumeHelperJob) Name() string

func (*PruningVolumeHelperJob) Reschedule

func (j *PruningVolumeHelperJob) Reschedule(ctx context.Context) error

func (*PruningVolumeHelperJob) Run

func (*PruningVolumeHelperJob) Schedule

func (j *PruningVolumeHelperJob) Schedule(ctx context.Context) string

Schedule runs the pruning job every 5 minutes. This is intentionally not configurable; the idle timeout (read in Run) is the user-facing knob.

type ScheduledPruneJob

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

func NewScheduledPruneJob

func NewScheduledPruneJob(systemService *services.SystemService, settingsService *services.SettingsService, notificationService *services.NotificationService) *ScheduledPruneJob

func (*ScheduledPruneJob) Name

func (j *ScheduledPruneJob) Name() string

func (*ScheduledPruneJob) Reschedule

func (j *ScheduledPruneJob) Reschedule(ctx context.Context) error

func (*ScheduledPruneJob) Run

func (j *ScheduledPruneJob) Run(ctx context.Context)

func (*ScheduledPruneJob) Schedule

func (j *ScheduledPruneJob) Schedule(ctx context.Context) string

func (*ScheduledPruneJob) ShouldSchedule

func (j *ScheduledPruneJob) ShouldSchedule(ctx context.Context) bool

type VulnerabilityScanJob

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

VulnerabilityScanJob periodically scans all Docker images for vulnerabilities using Trivy. It is opt-in via the "vulnerabilityScanEnabled" setting.

func NewVulnerabilityScanJob

func NewVulnerabilityScanJob(vulnerabilityService *services.VulnerabilityService, settingsService *services.SettingsService) *VulnerabilityScanJob

NewVulnerabilityScanJob creates a new VulnerabilityScanJob.

func (*VulnerabilityScanJob) Name

func (j *VulnerabilityScanJob) Name() string

func (*VulnerabilityScanJob) Run

func (j *VulnerabilityScanJob) Run(ctx context.Context)

func (*VulnerabilityScanJob) Schedule

func (j *VulnerabilityScanJob) Schedule(ctx context.Context) string

Schedule returns the cron expression for the job. Defaults to daily at midnight.

func (*VulnerabilityScanJob) ShouldSchedule

func (j *VulnerabilityScanJob) ShouldSchedule(ctx context.Context) bool

Jump to

Keyboard shortcuts

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