From 8b1e819bf3483484bbaf91f0f3e0a55120ceef03 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 13 Nov 2023 08:15:00 -0800 Subject: [PATCH] fix: make sure to purge all the completed in resume() (#18429) currently previously completed jobs would re-run even if they are completed, causing incorrect behavior. --- cmd/batch-handlers.go | 6 ++++++ cmd/batch-rotate.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/cmd/batch-handlers.go b/cmd/batch-handlers.go index cfa537e08..b5a91f51f 100644 --- a/cmd/batch-handlers.go +++ b/cmd/batch-handlers.go @@ -262,6 +262,9 @@ func (r *BatchJobReplicateV1) StartFromSource(ctx context.Context, api ObjectLay if err := ri.load(ctx, api, job); err != nil { return err } + if ri.Complete { + return nil + } globalBatchJobsMetrics.save(job.ID, ri) delay := job.Replicate.Flags.Retry.Delay @@ -837,6 +840,9 @@ func (r *BatchJobReplicateV1) Start(ctx context.Context, api ObjectLayer, job Ba if err := ri.load(ctx, api, job); err != nil { return err } + if ri.Complete { + return nil + } globalBatchJobsMetrics.save(job.ID, ri) lastObject := ri.Object diff --git a/cmd/batch-rotate.go b/cmd/batch-rotate.go index b444b7d91..72eaf10f8 100644 --- a/cmd/batch-rotate.go +++ b/cmd/batch-rotate.go @@ -261,6 +261,9 @@ func (r *BatchJobKeyRotateV1) Start(ctx context.Context, api ObjectLayer, job Ba if err := ri.load(ctx, api, job); err != nil { return err } + if ri.Complete { + return nil + } globalBatchJobsMetrics.save(job.ID, ri) lastObject := ri.Object