Skip to content

Commit

Permalink
enlarge the gc workers to 10
Browse files Browse the repository at this point in the history
Signed-off-by: wang yan <wangyan@vmware.com>
  • Loading branch information
wy65701436 committed Jan 26, 2025
1 parent 28c3a0e commit d009366
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
6 changes: 3 additions & 3 deletions src/server/v2.0/handler/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/server/v2.0/handler/gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d009366

Please sign in to comment.