2.0 KiB
2.0 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-owned-loop-lifecycles | Own scheduler loop lifecycles | done | 1 | plan.md | ../../specs/tasks/run-scheduling.md |
Task 01: Own scheduler loop lifecycles
Acceptance
runs/scheduler.Schedulerandscheduler/cron.Loopeach start at most one owned goroutine and expose idempotent stop behavior.- Stop cancels future ticks and blocks until the currently executing processor tick or cron handler fan-out has returned.
- Parent-context cancellation drains through the same wait-group path without producing post-stop calls.
Verification
cd apps/backend && go test ./internal/runs/scheduler ./internal/scheduler/cron
Files likely touched
apps/backend/internal/runs/scheduler/scheduler.goapps/backend/internal/runs/scheduler/scheduler_test.goapps/backend/internal/scheduler/cron/cron.goapps/backend/internal/scheduler/cron/cron_test.go
Dependencies
None.
Parallelism
parallel-safe relative to Task 02 only: the file sets are disjoint and no
schema or shared contract file changes.
Inputs
- Spec: scheduler lifecycle and shutdown scenarios.
- Plan: Owned scheduler lifecycles.
- Pattern:
internal/integrations/healthpoll.PollerStart/Stop ownership.
Risks
- Avoid waiting while holding the lifecycle mutex.
- Preserve the under-100ms signal-driven dispatch test.
Output contract
Report the lifecycle behavior, files changed, test command/result, blockers,
remaining risks, and update this task plus plan.md status in the same
conversation.
Result
Schedulerandcron.Loopnow own their loop goroutines and expose idempotentStart/Stopmethods;Stopwaits for active processor ticks and cron handler fan-out.- Added channel-controlled tests for duplicate starts, active-work draining, and parent-context cancellation.
- Verification:
cd apps/backend && go test -race ./internal/runs/scheduler ./internal/scheduler/cron -count=1passed.