Documentation
¶
Overview ¶
Package wrap supplies reusable cron.Wrapper decorators: panic recovery, timeouts, retry and overlap control. Install them with cron.WithChain or cron.WithEntryChain. A wrapper's state is created when it is applied at Add time, so one wrapper value installed globally still tracks each entry separately.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelayIfRunning ¶
DelayIfRunning serializes invocations of one entry: an invocation that overlaps a running one waits for it to finish, then runs. A queued invocation returns ctx.Err() if its context is cancelled while waiting, and it holds its WithMaxConcurrent slot for the whole wait. Prefer SkipIfRunning when a late run is worthless.
func Recover ¶
Recover converts a panicking Job into an error ("cron: recovered panic: <value>") and logs the value and stack at error level. The scheduler already recovers job panics into cron.ErrJobPanic unless cron.WithoutRecover is set; use Recover to attach a custom logger, to recover inside an outer Retry so the panic is retried, or when running jobs outside the scheduler. The error does not wrap cron.ErrJobPanic.
func Retry ¶
func Retry(p cron.RetryPolicy) cron.Wrapper
Retry is shorthand for p.Wrapper(), for use in cron.WithChain and cron.WithEntryChain lists. cron.WithRetry and cron.WithEntryRetry install the same wrapper innermost automatically.
func SkipIfRunning ¶
SkipIfRunning drops an invocation that overlaps a running one, returning cron.ErrAlreadyRunning without calling the job. State is created when the wrapper is applied at Add time, so one value installed with cron.WithChain still tracks each entry separately.