diff --git a/cron/cron.go b/cron/cron.go index 948c044..e8669c7 100644 --- a/cron/cron.go +++ b/cron/cron.go @@ -2,6 +2,7 @@ package cron import ( "context" + "errors" "github.com/google/uuid" "go.uber.org/fx" "go.uber.org/zap" @@ -10,6 +11,10 @@ import ( "github.com/go-co-op/gocron/v2" ) +var ( + ErrRetryLimitReached = errors.New("Retry limit reached") +) + type CronService interface { Scheduler() gocron.Scheduler RegisterService(service CronableService) @@ -114,6 +119,7 @@ func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob { if params.Attempt >= params.Limit { c.logger.Error("Retryable task limit reached", zap.String("jobName", jobName), zap.String("jobID", jobID.String())) + params.Error(jobID, jobName, ErrRetryLimitReached) return }