schedule

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package schedule computes per-tenant report due-ness (pure cadence functions) and runs the scheduled generate+deliver loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Due

func Due(now time.Time, s config.Schedule) bool

Due reports whether now is at or past the scheduled time for its occurrence.

func PeriodKey

func PeriodKey(now time.Time, s config.Schedule) string

PeriodKey identifies the occurrence of now under s's cadence: a delivery is recorded once per (tenant, period), so the key must be stable within an occurrence and change across them.

func ScheduledTime

func ScheduledTime(now time.Time, s config.Schedule) time.Time

ScheduledTime is the send instant for the occurrence containing now (UTC): daily → today @ hour; weekly → this ISO week's weekday @ hour; monthly → this month's day (clamped) @ hour.

Types

type Scheduler

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

Scheduler periodically generates and delivers each tenant's report on its cadence.

func New

func New(store *report.Store, d delivery.Deliverer, schedules []config.Schedule, brand string) *Scheduler

New wires a scheduler. The tick (how often due-ness is re-checked) is 1 minute — fine for hour-granularity cadences.

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context)

Run checks due-ness immediately, then every tick, until ctx is cancelled.

Jump to

Keyboard shortcuts

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