From d745ad9175b2de7399c262d0daa25c172da879fa Mon Sep 17 00:00:00 2001 From: Wang Yan Date: Mon, 17 Jul 2023 15:28:21 +0800 Subject: [PATCH] fix gc schedule issue (#18934) fixes #18881 Save workers settings into the metadata of the garbage collection schedule Signed-off-by: wang yan --- src/controller/gc/controller.go | 1 + src/controller/gc/controller_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/controller/gc/controller.go b/src/controller/gc/controller.go index ab34a6041..8ade07f3f 100644 --- a/src/controller/gc/controller.go +++ b/src/controller/gc/controller.go @@ -205,6 +205,7 @@ func (c *controller) GetSchedule(ctx context.Context) (*scheduler.Schedule, erro func (c *controller) CreateSchedule(ctx context.Context, cronType, cron string, policy Policy) (int64, error) { extras := make(map[string]interface{}) extras["delete_untagged"] = policy.DeleteUntagged + extras["workers"] = policy.Workers return c.schedulerMgr.Schedule(ctx, job.GarbageCollectionVendorType, -1, cronType, cron, job.GarbageCollectionVendorType, policy, extras) } diff --git a/src/controller/gc/controller_test.go b/src/controller/gc/controller_test.go index 02f3af0c4..857f4ecff 100644 --- a/src/controller/gc/controller_test.go +++ b/src/controller/gc/controller_test.go @@ -150,6 +150,7 @@ func (g *gcCtrTestSuite) TestCreateSchedule() { p := Policy{ DeleteUntagged: true, ExtraAttrs: dataMap, + Workers: 3, } id, err := g.ctl.CreateSchedule(nil, "Daily", "* * * * * *", p) g.Nil(err)