mirror of
https://github.com/goharbor/harbor
synced 2025-05-06 17:51:07 +00:00
enlarge the gc workers to 10 (#21462)
Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
490f898aec
commit
f35ed6df16
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user