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)
|
||||
|
||||
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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue