Skip to content

Commit 15747ba

Browse files
committed
fix: progressJobMaintenance was not cleaning properly job_progress table
1 parent 032b406 commit 15747ba

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

server/repository/repository.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,6 @@ func (s *SQLRepository) deleteProgressJob(ctx context.Context, conn SQLDBOperati
682682
return err
683683
}
684684
return nil
685-
686685
}
687686

688687
func (s *SQLRepository) getAllProgressJobs(ctx context.Context, conn SQLDBOperations) ([]model.TaskProgressType, error) {
@@ -693,7 +692,7 @@ func (s *SQLRepository) getAllProgressJobs(ctx context.Context, conn SQLDBOperat
693692
defer rows.Close()
694693
var progressJobs []model.TaskProgressType
695694
var etaSeconds float64
696-
if rows.Next() {
695+
for rows.Next() {
697696
progress := model.TaskProgressType{}
698697
err = rows.Scan(&progress.ProgressID, &progress.NotificationType, &progress.JobId, &progress.WorkerName, &progress.Percent, &etaSeconds, &progress.EventTime)
699698
if err != nil {

server/scheduler/scheduler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func (r *RuntimeScheduler) scheduleRoutine(ctx context.Context) {
240240
case checksumPath := <-r.checksumChan:
241241
r.pathChecksumMap[checksumPath.path] = checksumPath.checksum
242242
case <-progressTicker.C:
243-
if err := r.progressJobMaitenance(ctx); err != nil {
243+
if err := r.progressJobMaintenance(ctx); err != nil {
244244
log.Errorf("Error on progress job maintenance: %s", err)
245245
}
246246
case <-maintenanceTicker.C:
@@ -499,7 +499,7 @@ func (r *RuntimeScheduler) stop() {
499499

500500
}
501501

502-
func (r *RuntimeScheduler) progressJobMaitenance(ctx context.Context) error {
502+
func (r *RuntimeScheduler) progressJobMaintenance(ctx context.Context) error {
503503
progressJobs, err := r.repo.GetAllProgressJobs(ctx)
504504
if err != nil {
505505
return err

0 commit comments

Comments
 (0)