feat: add support for tags in RetryableTask
This commit is contained in:
parent
2a067102da
commit
4bb34315eb
|
@ -40,6 +40,7 @@ type CronServiceImpl struct {
|
||||||
|
|
||||||
type RetryableTaskParams struct {
|
type RetryableTaskParams struct {
|
||||||
Name string
|
Name string
|
||||||
|
Tags []string
|
||||||
Function any
|
Function any
|
||||||
Args []any
|
Args []any
|
||||||
Attempt uint
|
Attempt uint
|
||||||
|
@ -129,11 +130,16 @@ func (c *CronServiceImpl) RetryableTask(params RetryableTaskParams) CronJob {
|
||||||
}), gocron.AfterJobRuns(params.After))
|
}), gocron.AfterJobRuns(params.After))
|
||||||
|
|
||||||
name := gocron.WithName(params.Name)
|
name := gocron.WithName(params.Name)
|
||||||
|
options := []gocron.JobOption{listeners, name}
|
||||||
|
|
||||||
|
if len(params.Tags) > 0 {
|
||||||
|
options = append(options, gocron.WithTags(params.Tags...))
|
||||||
|
}
|
||||||
|
|
||||||
return CronJob{
|
return CronJob{
|
||||||
Job: job,
|
Job: job,
|
||||||
Task: task,
|
Task: task,
|
||||||
Options: []gocron.JobOption{listeners, name},
|
Options: options,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue