fix: anchor floor on re-enable; breaker on scheduled panic; propagate next-run err; reject negative interval; close phantom runs on startup

This commit is contained in:
2026-07-03 13:31:58 +07:00
parent e8acab6920
commit 64bcb1d60b
7 changed files with 55 additions and 10 deletions
+6
View File
@@ -19,6 +19,12 @@ func TestNextRun(t *testing.T) {
if got := NextRun(time.Hour, anchor, &fin); !got.Equal(fin.Add(time.Hour)) {
t.Fatalf("recurring: got %v", got)
}
// Re-enable: anchor is newer than a stale lastFinished from before re-enable →
// use anchor, not the stale lastFinished (which would fire immediately/in the past).
staleFin := anchor.Add(-2 * time.Hour)
if got := NextRun(time.Hour, anchor, &staleFin); !got.Equal(anchor.Add(time.Hour)) {
t.Fatalf("re-enable: got %v, want %v", got, anchor.Add(time.Hour))
}
}
func TestDueTaskIDs(t *testing.T) {