Skip to content

Commit

Permalink
fix grpc provider scan
Browse files Browse the repository at this point in the history
fix grpc provider scan
  • Loading branch information
oke11o committed Oct 19, 2023
1 parent 9ad5891 commit 0db2f1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"go.uber.org/zap/zapcore"
)

const Version = "0.5.11"
const Version = "0.5.12"
const defaultConfigFile = "load"
const stdinConfigSelector = "-"

Expand Down
4 changes: 2 additions & 2 deletions components/guns/grpc/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (g *Gun) WarmUp(opts *warmup.Options) (interface{}, error) {
refClient := grpcreflect.NewClientAuto(refCtx, conn)
listServices, err := refClient.ListServices()
if err != nil {
g.GunDeps.Log.Error("failed to get services list", zap.Error(err))
opts.Log.Error("failed to get services list", zap.Error(err)) // WarmUp calls before Bind()
return nil, fmt.Errorf("refClient.ListServices err: %w", err)
}
services := make(map[string]desc.MethodDescriptor)
Expand All @@ -98,7 +98,7 @@ func (g *Gun) WarmUp(opts *warmup.Options) (interface{}, error) {
if grpcreflect.IsElementNotFoundError(err) {
continue
}
g.GunDeps.Log.Error("cant resolveService", zap.String("service_name", s), zap.Error(err))
opts.Log.Error("cant resolveService", zap.String("service_name", s), zap.Error(err)) // WarmUp calls before Bind()
return nil, fmt.Errorf("cant resolveService %s; err: %w", s, err)
}
listMethods := service.GetMethods()
Expand Down
6 changes: 5 additions & 1 deletion components/providers/grpc/grpcjson/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ func (p *Provider) start(ctx context.Context, ammoFile afero.File) error {
return nil
}
}
err := scanner.Err()
if err != nil {
return errors.Wrap(err, "gPRC Provider scan() err")
}
if p.Passes != 0 && passNum >= p.Passes {
break
}
_, err := ammoFile.Seek(0, 0)
_, err = ammoFile.Seek(0, 0)
if err != nil {
return errors.Wrap(err, "Failed to seek ammo file")
}
Expand Down

0 comments on commit 0db2f1a

Please sign in to comment.