Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enlarge the gc workers to 10 #21462

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading