scheduler

package
v0.1.147 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package scheduler provides the periodic full-scan pipeline, DB maintenance, and auth cleanup scheduling for the subflux server.

Index

Constants

View Source
const AuthCleanupInterval = 15 * time.Minute

AuthCleanupInterval is how often expired sessions and stale auth state are purged from the database.

View Source
const OIDCStateTTL = 10 * time.Minute

OIDCStateTTL is how long an OIDC authorization flow can remain pending before garbage collection.

View Source
const StartupDelay = 30 * time.Second

StartupDelay is the delay before the first scan after startup.

Variables

This section is empty.

Functions

func GuardedScan

func GuardedScan(ctx context.Context, deps *Deps)

GuardedScan acquires the scanning flag before running a full scan.

func Run

func Run(ctx context.Context, deps *Deps)

Run runs the periodic scan and DB maintenance tickers until ctx is cancelled.

func RunDBMaintenance

func RunDBMaintenance(ctx context.Context, deps *Deps)

RunDBMaintenance prunes old state and stale search attempts.

func RunFullScan

func RunFullScan(ctx context.Context, deps *Deps)

RunFullScan delegates to the scanning package's RunFullScan.

Types

type Deps

type Deps struct {
	DB                  api.Store
	Metrics             scanning.ScanMetrics
	ReconcileMetrics    ReconcileMetrics // nil-safe; omit to skip reconcile metrics
	Events              *serveradapter.ScanEventAdapter
	Activity            *serveradapter.ActivityAdapter
	Alerts              *serveradapter.AlertAdapter
	ShowSkipCache       *showskip.Cache
	StateFunc           func() *LiveState
	ScanningFlag        *atomic.Bool
	DeleteSubtitleFiles func(paths []string, source string)
}

Deps holds all dependencies for the scheduler.

type LiveState

type LiveState struct {
	Cfg       api.ConfigProvider
	Engine    api.SearchEngine
	Sonarr    api.SonarrClient
	Radarr    api.RadarrClient
	Providers []api.Provider
}

LiveState holds the live state needed by the scheduler.

type ReconcileMetrics added in v0.1.54

type ReconcileMetrics interface {
	RecordReconcile(deleted int, reset int64, dur time.Duration)
}

ReconcileMetrics is the narrow observability interface for reconcile passes. The concrete *metrics.Metrics satisfies this via structural typing.

type Store

type Store interface {
	ReconcileState(ctx context.Context) (api.ReconcileResult, error)
	Stats(ctx context.Context) (downloads, attempts int, err error)
}

Store is the narrow store interface used by RunDBMaintenance.

Jump to

Keyboard shortcuts

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