fix: fix after and error functions

This commit is contained in:
Derrick Hammer 2024-02-01 18:51:05 -05:00
parent 0a6efaf0e3
commit 9330bb36bf
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 6 deletions

View File

@ -101,14 +101,12 @@ func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob {
task := gocron.NewTask(params.Function, params.Args...)
afterFunc := params.After
if afterFunc == nil {
afterFunc = func(jobID uuid.UUID, jobName string) {}
if params.After == nil {
params.After = func(jobID uuid.UUID, jobName string) {}
}
errorFunc := params.Error
if errorFunc == nil {
errorFunc = func(jobID uuid.UUID, jobName string, err error) {}
if params.Error == nil {
params.Error = func(jobID uuid.UUID, jobName string, err error) {}
}
listeners := gocron.WithEventListeners(gocron.AfterJobRunsWithError(func(jobID uuid.UUID, jobName string, err error) {