dailycheck

package
v0.56.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dailycheck is the daily beat the update checks run on — the app plugins' (wasmplugin/updates.go) and the storage plugins' (plugin/updates.go): a check a day after the last one, never sooner than a short wait after start, with the time of the last run kept in the settings table so a restart neither skips a day nor checks at every boot.

⚠ One beat, not two: both checks had their own copy of this loop until the duplication gate caught the second (web/tests/quality/duplication.test.ts).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beat

type Beat struct {
	Store Settings
	// Key is the settings key holding the last run (RFC 3339).
	Key string
	// First is the least wait after start; Interval the time between runs.
	First, Interval time.Duration
	// Now is the clock (time.Now when nil).
	Now func() time.Time
}

Beat is one daily check's schedule.

func (Beat) Last

func (b Beat) Last(ctx context.Context) time.Time

Last is when the check last ran; zero when never.

func (Beat) Run

func (b Beat) Run(ctx context.Context, check func(context.Context) error, failed func(error))

Run calls check each time the beat comes round, until ctx ends. A failed check is handed to failed (when ctx is still alive) and the beat goes on.

func (Beat) Wait

func (b Beat) Wait(ctx context.Context) time.Duration

Wait is how long until the next run: Interval after the last, and never less than First.

type Settings

type Settings interface {
	GetSetting(ctx context.Context, key string) (string, error)
}

Settings is the part of the store the beat reads.

Jump to

Keyboard shortcuts

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