CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/golang-github-com-go-co-op-gocron-v2

A Golang job scheduling library that lets you run Go functions at pre-determined intervals using cron expressions, fixed durations, daily, weekly, monthly, or one-time schedules with support for distributed deployments.

Overview
Eval results
Files

options.mddocs/guides/api/

API Reference: Options

Quick reference for job and scheduler options.

Job Options

Options that configure individual jobs.

Identity Options

gocron.WithName("job-name")
gocron.WithTags("tag1", "tag2")

See Identity Options API

Concurrency Options

gocron.WithSingletonMode(gocron.LimitModeReschedule)
gocron.WithIntervalFromCompletion()

See Concurrency Options API

Timing Options

gocron.WithStartAt(gocron.WithStartImmediately())
gocron.WithStartAt(gocron.WithStartDateTime(time.Now().Add(time.Hour)))
gocron.WithLimitRunsTo(100)

See Timing Options API

Event Options

gocron.WithEventListeners(
    gocron.BeforeJobRuns(func(uuid.UUID, string) { /* ... */ }),
    gocron.AfterJobRuns(func(uuid.UUID, string) { /* ... */ }),
    gocron.AfterJobRunsWithError(func(uuid.UUID, string, error) { /* ... */ }),
)

See Event Options API

Distributed Options

gocron.WithDistributedJobLocker(locker)

See Distributed Options API

Scheduler Options

Options that configure the scheduler.

Concurrency

gocron.WithLimitConcurrentJobs(10, gocron.LimitModeReschedule)

Lifecycle

gocron.WithStopTimeout(30*time.Second)
gocron.WithGlobalJobOptions(
    gocron.WithTags("global"),
)

Observability

gocron.WithLogger(myLogger)
gocron.WithMonitor(myMonitor)
gocron.WithMonitorStatus(myStatusMonitor)
gocron.WithSchedulerMonitor(mySchedulerMonitor)

Distributed

gocron.WithDistributedElector(elector)
gocron.WithDistributedLocker(locker)

Location

loc, _ := time.LoadLocation("America/New_York")
gocron.WithLocation(loc)

See Scheduler Creation API

See Also

Install with Tessl CLI

npx tessl i tessl/golang-github-com-go-co-op-gocron-v2

docs

index.md

tile.json