Skip to content

Commit

Permalink
fix: option name
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Nov 7, 2023
1 parent ca83439 commit 78f349a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pkg/index/job/save/service/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
type Option func(_ *index) error

var defaultOpts = []Option{
WithIndexingConcurrency(1),
WithSaveIndexingConcurrency(1),
}

// WithDiscoverer returns Option that sets discoverer client.
Expand All @@ -36,11 +36,11 @@ func WithDiscoverer(client discoverer.Client) Option {
}
}

// WithIndexingConcurrency returns Option that sets indexing concurrency.
func WithIndexingConcurrency(num int) Option {
// WithSaveIndexingConcurrency returns Option that sets save indexing concurrency.
func WithSaveIndexingConcurrency(num int) Option {
return func(idx *index) error {
if num <= 0 {
return errors.NewErrInvalidOption("indexingConcurrency", num)
return errors.NewErrInvalidOption("saveIndexingConcurrency", num)
}
idx.concurrency = num
return nil

Check warning on line 46 in pkg/index/job/save/service/options.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/save/service/options.go#L42-L46

Added lines #L42 - L46 were not covered by tests
Expand Down
4 changes: 2 additions & 2 deletions pkg/index/job/save/service/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ package service
// }
// }
//
// func TestWithIndexingConcurrency(t *testing.T) {
// func TestWithSaveIndexingConcurrency(t *testing.T) {
// type args struct {
// num int
// }
Expand Down Expand Up @@ -178,7 +178,7 @@ package service
// checkFunc = defaultCheckFunc
// }
//
// got := WithIndexingConcurrency(test.args.num)
// got := WithSaveIndexingConcurrency(test.args.num)
// if err := checkFunc(test.want, got); err != nil {
// tt.Errorf("error = %v", err)
// }
Expand Down
2 changes: 1 addition & 1 deletion pkg/index/job/save/usecase/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func New(cfg *config.Data) (_ runner.Runner, err error) {

indexer, err := service.New(
service.WithDiscoverer(discoverer),
service.WithIndexingConcurrency(cfg.Save.Concurrency),
service.WithSaveIndexingConcurrency(cfg.Save.Concurrency),
service.WithTargetAddrs(cfg.Save.TargetAddrs...),
)
if err != nil {
Expand Down

0 comments on commit 78f349a

Please sign in to comment.