What's New
- New method WithContext supports providing a parent context by @27149chen in #819 & @JohnRoesler in #820
// WithContext sets the parent context for the job.
// If you set the first argument of your Task func to be a context.Context,
// gocron will pass in the provided context to the job and will cancel the
// context on shutdown. If you cancel the context the job will no longer be
// scheduled as well. This allows you to both control the job via a context
// and listen for and handle cancellation within your job.
- Job task function now supports passing a ctx if the first argument in your function is a
context.Context
by @27149chen in #819 & @JohnRoesler in #820
// NewTask provides the job's task function and parameters.
// If you set the first argument of your Task func to be a context.Context,
// gocron will pass in a context (either the default Job context, or one
// provided via WithContext) to the job and will cancel the context on shutdown.
// This allows you to listen for and handle cancellation within your job.
Chores
- Bump golangci/golangci-lint-action from 6.1.1 to 6.2.0 by @dependabot in #817
Full Changelog: v2.14.2...v2.15.0