fix: fix after and error functions
This commit is contained in:
parent
0a6efaf0e3
commit
9330bb36bf
10
cron/cron.go
10
cron/cron.go
|
@ -101,14 +101,12 @@ func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob {
|
||||||
|
|
||||||
task := gocron.NewTask(params.Function, params.Args...)
|
task := gocron.NewTask(params.Function, params.Args...)
|
||||||
|
|
||||||
afterFunc := params.After
|
if params.After == nil {
|
||||||
if afterFunc == nil {
|
params.After = func(jobID uuid.UUID, jobName string) {}
|
||||||
afterFunc = func(jobID uuid.UUID, jobName string) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errorFunc := params.Error
|
if params.Error == nil {
|
||||||
if errorFunc == nil {
|
params.Error = func(jobID uuid.UUID, jobName string, err error) {}
|
||||||
errorFunc = func(jobID uuid.UUID, jobName string, err error) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listeners := gocron.WithEventListeners(gocron.AfterJobRunsWithError(func(jobID uuid.UUID, jobName string, err error) {
|
listeners := gocron.WithEventListeners(gocron.AfterJobRunsWithError(func(jobID uuid.UUID, jobName string, err error) {
|
||||||
|
|
Loading…
Reference in New Issue