application

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package application holds the digest use cases — the stuck-PR reporter and the cron scheduler — behind the domain's use-case interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reporter

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

Reporter builds and posts the stuck-PR digest for every channel that owns at least one stuck PR. It is the application's DigestReporter and, via ReportSchedule, its ScheduleJob.

func NewReporter

func NewReporter(params domain.ReporterParams) *Reporter

NewReporter constructs a Reporter from its params. Now defaults to time.Now and TZ to UTC when unset.

func (*Reporter) Report

func (r *Reporter) Report(ctx context.Context) error

Report runs one digest pass including all enabled repos: find open PRs idle since the start of today, group them by channel, and post one reminder per channel. A failed post for one channel is logged and skipped so the others still go out.

func (*Reporter) ReportSchedule

func (r *Reporter) ReportSchedule(ctx context.Context, spec string) error

ReportSchedule runs one digest pass for a single cron spec: it includes only stuck PRs whose repo's effective digest is enabled and scheduled at spec.

type Scheduler

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

Scheduler runs one cron per distinct schedule spec, calling its job for each tick with the matching spec. It mirrors the maintenance cleaner's Run(ctx) shape so the composition root can start both the same way.

func NewScheduler

func NewScheduler(params domain.SchedulerParams) (*Scheduler, error)

NewScheduler validates every cron spec up front so a malformed schedule fails fast at startup rather than silently never firing. Specs is a list of standard 5-field cron expressions (e.g. ["0 9 * * *", "0 18 * * *"]); TZ is the timezone every spec is interpreted in (nil defaults to UTC).

func (*Scheduler) Run

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

Run starts the cron loop with one entry per spec and blocks until ctx is cancelled, then waits for in-flight runs to finish before returning. Always returns nil (the signature stays error-returning to compose with other long-running goroutines).

Jump to

Keyboard shortcuts

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