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 Calendar ¶ added in v0.23.0
type Calendar struct {
// contains filtered or unexported fields
}
Calendar answers whether a digest tick falls on a day the team is off. It is the application's DigestCalendar.
func NewCalendar ¶ added in v0.23.0
func NewCalendar(params domain.CalendarParams) *Calendar
NewCalendar resolves the country code to a holiday table.
It never fails. An unset or unrecognized code degrades to weekends-only and warns; it does not abort startup the way an invalid cron spec or timezone does. Those two decide *when* the server runs at all, whereas the country only enriches one feature — so a typo in it must not take the deployment down. This mirrors the token degradation elsewhere (an absent GITHUB_TOKEN makes path rules inert rather than fatal).
Both warnings fire once, here, rather than on every tick: with no usable table there is no way to know that a given day was a holiday, so a per-tick line would carry no information and would repeat daily forever.
func (*Calendar) Country ¶ added in v0.23.0
Country is the resolved country code, empty when none is configured.
func (*Calendar) HolidayName ¶ added in v0.23.0
HolidayName returns the holiday falling on now's calendar day, if any. It reports false for every day when no country is configured.
func (*Calendar) SkipReason ¶ added in v0.23.0
SkipReason reports whether the digest should be suppressed for now's calendar day. now is expected to already be in the digest timezone; the calendar reads its fields as given and never re-derives a location.
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.
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).