refactor: rename RetryableTask to RetryableJob

This commit is contained in:
Derrick Hammer 2024-02-25 07:47:43 -05:00
parent 5c3d1144d4
commit d618f08275
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
4 changed files with 7 additions and 7 deletions

View File

@ -806,8 +806,8 @@ func (s *S5API) accountPin(jc jape.Context) {
jobName := fmt.Sprintf("pin-import-%s", cid64)
if task := s.cron.GetJobByName(jobName); task == nil {
task := s.cron.RetryableTask(
cron.RetryableTaskParams{
task := s.cron.RetryableJob(
cron.RetryableJobParams{
Name: jobName,
Tags: nil,
Function: s.pinImportCronTask,

View File

@ -45,7 +45,7 @@ type CronServiceDefault struct {
logger *zap.Logger
}
type RetryableTaskParams struct {
type RetryableJobParams struct {
Name string
Tags []string
Function any
@ -99,7 +99,7 @@ func (c *CronServiceDefault) RegisterService(service CronableService) {
c.services = append(c.services, service)
}
func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob {
func (c *CronServiceDefault) RetryableJob(params RetryableJobParams) CronJob {
job := gocron.OneTimeJob(gocron.OneTimeJobStartImmediately())
if params.Attempt > 0 {
@ -128,7 +128,7 @@ func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob {
taskRetry := params
taskRetry.Attempt++
retryTask := c.RetryableTask(taskRetry)
retryTask := c.RetryableJob(taskRetry)
retryTask.JobId = jobID
_, err = c.RerunJob(retryTask)

View File

@ -251,7 +251,7 @@ func (t *TusHandler) ScheduleUpload(ctx context.Context, uploadID string) error
return errors.New("upload not found")
}
task := t.cron.RetryableTask(cron.RetryableTaskParams{
task := t.cron.RetryableJob(cron.RetryableJobParams{
Name: "tusUpload",
Function: t.uploadTask,
Args: []interface{}{upload.Hash},

View File

@ -207,7 +207,7 @@ func (r *RenterDefault) UploadObjectMultipart(ctx context.Context, params *Multi
partNumber := int(i + 1)
job := r.cron.RetryableTask(cron.RetryableTaskParams{
job := r.cron.RetryableJob(cron.RetryableJobParams{
Name: fileName + "-part-" + strconv.FormatUint(i, 10),
Function: func() error {
reader, err := rf(uint(start), uint(end))