Skip to content

Commit

Permalink
tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
highpon committed Dec 15, 2024
1 parent 26e2322 commit 11d9d77
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
3 changes: 2 additions & 1 deletion cmd/index/job/exportation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func main() {
runner.WithName(name),
runner.WithVersion(info.Version, maxVersion, minVersion),
runner.WithConfigLoader(func(path string) (any, *config.GlobalConfig, error) {
cfg, err := config.NewConfig(path)
// cfg, err := config.NewConfig(path)
cfg, err := config.NewConfig("cmd/index/job/exportation/sample.yaml")
if err != nil {
return nil, nil, errors.Wrap(err, "failed to load "+name+"'s configuration")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/index/job/exportation/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ exporter:
index_path: "/var/export/index"
gateway:
addrs:
- vald-lb-gateway.default.svc.cluster.local:8081
- localhost:20000
health_check_duration: "1s"
connection_pool:
enable_dns_resolver: true
Expand Down
40 changes: 22 additions & 18 deletions pkg/index/job/exportation/usecase/exportation.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ import (
"syscall"

"github.com/vdaas/vald/internal/client/v1/client/vald"
iconf "github.com/vdaas/vald/internal/config"
"github.com/vdaas/vald/internal/errors"
"github.com/vdaas/vald/internal/log"

"github.com/vdaas/vald/internal/net/grpc"
"github.com/vdaas/vald/internal/net/grpc/interceptor/server/recover"
"github.com/vdaas/vald/internal/observability"
"github.com/vdaas/vald/internal/runner"
"github.com/vdaas/vald/internal/safety"
"github.com/vdaas/vald/internal/servers/server"
"github.com/vdaas/vald/internal/servers/starter"
"github.com/vdaas/vald/internal/sync/errgroup"
"github.com/vdaas/vald/pkg/index/job/exportation/config"
Expand Down Expand Up @@ -74,29 +78,29 @@ func New(cfg *config.Data) (_ runner.Runner, err error) {
}
}

// grpcServerOptions := []server.Option{
// server.WithGRPCOption(
// grpc.ChainUnaryInterceptor(recover.RecoverInterceptor()),
// grpc.ChainStreamInterceptor(recover.RecoverStreamInterceptor()),
// ),
// }

// // For health check and metrics
// srv, err := starter.New(starter.WithConfig(cfg.Server),
// starter.WithGRPC(func(_ *iconf.Server) []server.Option {
// return grpcServerOptions
// }),
// )
// if err != nil {
// return nil, err
// }
grpcServerOptions := []server.Option{
server.WithGRPCOption(
grpc.ChainUnaryInterceptor(recover.RecoverInterceptor()),
grpc.ChainStreamInterceptor(recover.RecoverStreamInterceptor()),
),
}

// For health check and metrics
srv, err := starter.New(starter.WithConfig(cfg.Server),
starter.WithGRPC(func(_ *iconf.Server) []server.Option {
return grpcServerOptions
}),
)
if err != nil {
return nil, err
}

return &run{
eg: eg,
cfg: cfg,
observability: obs,
// server: srv,
exporter: exporter,
server: srv,
exporter: exporter,
}, nil
}

Expand Down

0 comments on commit 11d9d77

Please sign in to comment.