Owner Finish control on the Series detail page: confirm-gated finish, instant un-finish (#158)
This commit is contained in:
@@ -1440,6 +1440,21 @@ func (s *Store) ForceSeriesPoll(site, seriesID string, at int64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSeriesFinished stamps or clears the owner's finish. at is unix ms to
|
||||
// finish, zero to un-finish. A finished Series drops out of the Lane's reads
|
||||
// (issue #157), and nothing else writes this column: it is the only writer
|
||||
// outside migration 0016, so a machine write can never retire a Series
|
||||
// silently. Touching a missing series is not an error: the row may have been
|
||||
// orphaned, and the caller's read decides what exists.
|
||||
func (s *Store) SetSeriesFinished(site, seriesID string, at int64) error {
|
||||
if _, err := s.db.Exec(
|
||||
`UPDATE series SET finished_at = $1 WHERE site = $2 AND series_id = $3`,
|
||||
at, site, seriesID); err != nil {
|
||||
return fmt.Errorf("set series finished %s:%s: %w", site, seriesID, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// LatestCheckedAt reads the column MarkLatestChecked writes. It exists for
|
||||
// tests outside this package (the poller's own tests assert on rest
|
||||
// bookkeeping) — see MarkLatestChecked for why the field stays off the
|
||||
|
||||
Reference in New Issue
Block a user