Fixed rate
Repeat work on a steady interval
Run at a steady rate
Use ScheduleAtFixedRate when the interval itself is the important part of the
schedule.
scheduler.ScheduleAtFixedRate(func(ctx context.Context) {
println("collect metrics")
}, 10*time.Second)Fixed rate schedules are useful for metrics, heartbeats, and periodic checks where the application expects a steady cadence.
Pick fixed rate intentionally
Fixed rate is different from fixed delay. Fixed delay waits after each task finishes. Fixed rate targets a regular interval.
scheduler.ScheduleAtFixedRate(func(ctx context.Context) {
println("publish heartbeat")
}, 30*time.Second)Use fixed rate when the schedule represents a clock-like cadence rather than a pause after each completed run.
