Chrono|Docs

Fixed delay

Repeat work after the previous execution finishes

Delay after each run

Use ScheduleWithFixedDelay when the delay should start after the task finishes.

main.go
scheduler.ScheduleWithFixedDelay(func(ctx context.Context) {
	println("poll upstream service")
}, 15*time.Second)

This is the safer default for jobs that should not overlap. If the task takes three seconds and the delay is fifteen seconds, the next execution starts after the task finishes and the delay passes.

When to use it

Fixed delay works well for:

  • Polling external services.
  • Syncing data in batches.
  • Cleanup jobs.
  • Work where overlap would cause duplicate writes or noisy retries.
main.go
scheduler.ScheduleWithFixedDelay(func(ctx context.Context) {
	println("delete expired sessions")
}, time.Minute)

Use this schedule when task duration matters more than hitting an exact wall clock interval.