fix gc schedule issue (#18934)

fixes #18881

Save workers settings into the metadata of the garbage collection schedule

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
Wang Yan 2023-07-17 15:28:21 +08:00 committed by GitHub
parent ff2b99d711
commit d745ad9175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -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)
}

View File

@ -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)