fix: ensure limit is greater than 0

This commit is contained in:
Derrick Hammer 2024-02-01 21:03:19 -05:00
parent 9063a80f8c
commit 185f5de87a
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 1 deletions

View File

@ -117,7 +117,7 @@ func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob {
listeners := gocron.WithEventListeners(gocron.AfterJobRunsWithError(func(jobID uuid.UUID, jobName string, err error) {
params.Error(jobID, jobName, err)
if params.Attempt >= params.Limit {
if params.Attempt >= params.Limit && params.Limit > 0 {
c.logger.Error("Retryable task limit reached", zap.String("jobName", jobName), zap.String("jobID", jobID.String()))
params.Error(jobID, jobName, ErrRetryLimitReached)
return