refactor: rename RetryableTask to RetryableJob
This commit is contained in:
parent
5c3d1144d4
commit
d618f08275
|
@ -806,8 +806,8 @@ func (s *S5API) accountPin(jc jape.Context) {
|
||||||
jobName := fmt.Sprintf("pin-import-%s", cid64)
|
jobName := fmt.Sprintf("pin-import-%s", cid64)
|
||||||
|
|
||||||
if task := s.cron.GetJobByName(jobName); task == nil {
|
if task := s.cron.GetJobByName(jobName); task == nil {
|
||||||
task := s.cron.RetryableTask(
|
task := s.cron.RetryableJob(
|
||||||
cron.RetryableTaskParams{
|
cron.RetryableJobParams{
|
||||||
Name: jobName,
|
Name: jobName,
|
||||||
Tags: nil,
|
Tags: nil,
|
||||||
Function: s.pinImportCronTask,
|
Function: s.pinImportCronTask,
|
||||||
|
|
|
@ -45,7 +45,7 @@ type CronServiceDefault struct {
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
type RetryableTaskParams struct {
|
type RetryableJobParams struct {
|
||||||
Name string
|
Name string
|
||||||
Tags []string
|
Tags []string
|
||||||
Function any
|
Function any
|
||||||
|
@ -99,7 +99,7 @@ func (c *CronServiceDefault) RegisterService(service CronableService) {
|
||||||
c.services = append(c.services, service)
|
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())
|
job := gocron.OneTimeJob(gocron.OneTimeJobStartImmediately())
|
||||||
|
|
||||||
if params.Attempt > 0 {
|
if params.Attempt > 0 {
|
||||||
|
@ -128,7 +128,7 @@ func (c *CronServiceDefault) RetryableTask(params RetryableTaskParams) CronJob {
|
||||||
taskRetry := params
|
taskRetry := params
|
||||||
taskRetry.Attempt++
|
taskRetry.Attempt++
|
||||||
|
|
||||||
retryTask := c.RetryableTask(taskRetry)
|
retryTask := c.RetryableJob(taskRetry)
|
||||||
retryTask.JobId = jobID
|
retryTask.JobId = jobID
|
||||||
|
|
||||||
_, err = c.RerunJob(retryTask)
|
_, err = c.RerunJob(retryTask)
|
||||||
|
|
|
@ -251,7 +251,7 @@ func (t *TusHandler) ScheduleUpload(ctx context.Context, uploadID string) error
|
||||||
return errors.New("upload not found")
|
return errors.New("upload not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
task := t.cron.RetryableTask(cron.RetryableTaskParams{
|
task := t.cron.RetryableJob(cron.RetryableJobParams{
|
||||||
Name: "tusUpload",
|
Name: "tusUpload",
|
||||||
Function: t.uploadTask,
|
Function: t.uploadTask,
|
||||||
Args: []interface{}{upload.Hash},
|
Args: []interface{}{upload.Hash},
|
||||||
|
|
|
@ -207,7 +207,7 @@ func (r *RenterDefault) UploadObjectMultipart(ctx context.Context, params *Multi
|
||||||
|
|
||||||
partNumber := int(i + 1)
|
partNumber := int(i + 1)
|
||||||
|
|
||||||
job := r.cron.RetryableTask(cron.RetryableTaskParams{
|
job := r.cron.RetryableJob(cron.RetryableJobParams{
|
||||||
Name: fileName + "-part-" + strconv.FormatUint(i, 10),
|
Name: fileName + "-part-" + strconv.FormatUint(i, 10),
|
||||||
Function: func() error {
|
Function: func() error {
|
||||||
reader, err := rf(uint(start), uint(end))
|
reader, err := rf(uint(start), uint(end))
|
||||||
|
|
Loading…
Reference in New Issue