enlarge the gc workers to 10 (#21462)

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
Wang Yan 2025-02-11 16:51:17 +08:00 committed by GitHub
parent 490f898aec
commit f35ed6df16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -21,4 +21,4 @@ export const NO: string = 'TAG_RETENTION.NO';
export const REFRESH_STATUS_TIME_DIFFERENCE: number = 5000;
export const WORKER_OPTIONS: number[] = [1, 2, 3, 4, 5];
export const WORKER_OPTIONS: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

View File

@ -106,7 +106,7 @@ func (g *gcAPI) kick(ctx context.Context, scheType string, cron string, paramete
return 0, errors.BadRequestError(fmt.Errorf("workers should be integer format"))
}
if !validateWorkers(int(wInt)) {
return 0, errors.New(nil).WithCode(errors.BadRequestCode).WithMessagef("Error: Invalid number of workers:%s. Workers must be greater than 0 and less than or equal to 5.", workers)
return 0, errors.New(nil).WithCode(errors.BadRequestCode).WithMessagef("Error: Invalid number of workers:%s. Workers must be greater than 0 and less than or equal to 10.", workers)
}
policy.Workers = int(wInt)
}
@ -130,7 +130,7 @@ func (g *gcAPI) kick(ctx context.Context, scheType string, cron string, paramete
return 0, errors.BadRequestError(fmt.Errorf("workers should be integer format"))
}
if !validateWorkers(int(wInt)) {
return 0, errors.New(nil).WithCode(errors.BadRequestCode).WithMessagef("Error: Invalid number of workers:%s. Workers must be greater than 0 and less than or equal to 5.", workers)
return 0, errors.New(nil).WithCode(errors.BadRequestCode).WithMessagef("Error: Invalid number of workers:%s. Workers must be greater than 0 and less than or equal to 10.", workers)
}
policy.Workers = int(wInt)
}
@ -284,7 +284,7 @@ func (g *gcAPI) StopGC(ctx context.Context, params operation.StopGCParams) middl
}
func validateWorkers(workers int) bool {
if workers <= 0 || workers > 5 {
if workers <= 0 || workers > 10 {
return false
}
return true

View File

@ -8,7 +8,7 @@ import (
func TestValidateWorkers(t *testing.T) {
assert.False(t, validateWorkers(0))
assert.False(t, validateWorkers(10))
assert.False(t, validateWorkers(15))
assert.False(t, validateWorkers(-1))
assert.True(t, validateWorkers(1))
assert.True(t, validateWorkers(5))