Chrono|Docs

What is Chrono?

Understand how Chrono schedules work in Go applications

Chrono is a task scheduler for Go. It is built for application work that needs to run later, repeat after a delay, repeat at a fixed interval, or follow a cron expression.

Instead of scattering timers and goroutine management throughout the codebase, Chrono gives scheduling a clear API.

What Chrono provides

Chrono focuses on the scheduling primitives most applications need:

  • One-shot tasks for work that should run once at a specific time.
  • Fixed delay tasks for repeated work that should wait after each execution.
  • Fixed rate tasks for repeated work on a steady interval.
  • Cron tasks for calendar-based schedules.
  • Location support for schedules that need a specific time zone.
  • Cancellation and shutdown for lifecycle control.

Where it fits

Use Chrono when a Go service, worker, CLI, or backend process needs background work with predictable timing.

main.go
scheduler := chrono.NewDefaultTaskScheduler()

scheduler.ScheduleAtFixedRate(func(ctx context.Context) {
	println("refresh cache")
}, 30*time.Second)

The scheduler owns the timing behavior. Your task function owns the application work.

Scheduler lifecycle

Scheduled tasks can be cancelled individually:

main.go
task := scheduler.ScheduleWithFixedDelay(func(ctx context.Context) {
	println("sync data")
}, 10*time.Second)

task.Cancel()

The scheduler can also be shut down when the application is stopping:

main.go
<-scheduler.Shutdown()

This keeps task lifecycle explicit, which matters when scheduled work belongs to a larger application runtime.