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

Use ocis registry for refresh #2120

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-use-configured-registry
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: External storage registration used wrong config

The go-micro registry-singleton ignores the ocis configuration and defaults to mdns

https://github.com/owncloud/ocis/pull/2120
10 changes: 5 additions & 5 deletions storage/pkg/service/external/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log
Address: addr,
Metadata: make(map[string]string),
}
r := oregistry.GetRegistry()
ocisRegistry := oregistry.GetRegistry()

node.Metadata["broker"] = broker.String()
node.Metadata["registry"] = r.String()
node.Metadata["registry"] = ocisRegistry.String()
node.Metadata["server"] = "grpc"
node.Metadata["transport"] = "grpc"
node.Metadata["protocol"] = "grpc"
Expand All @@ -37,7 +37,7 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log
logger.Info().Msgf("registering external service %v@%v", node.Id, node.Address)

rOpts := []registry.RegisterOption{registry.RegisterTTL(time.Minute)}
if err := r.Register(service, rOpts...); err != nil {
if err := ocisRegistry.Register(service, rOpts...); err != nil {
logger.Fatal().Err(err).Msgf("Registration error for external service %v", serviceID)
}

Expand All @@ -48,14 +48,14 @@ func RegisterGRPCEndpoint(ctx context.Context, serviceID, uuid, addr string, log
select {
case <-t.C:
logger.Debug().Interface("service", service).Msg("refreshing external service-registration")
err := registry.Register(service, rOpts...)
err := ocisRegistry.Register(service, rOpts...)
if err != nil {
logger.Error().Err(err).Msgf("registration error for external service %v", serviceID)
}
case <-ctx.Done():
logger.Debug().Interface("service", service).Msg("unregistering")
t.Stop()
err := registry.Deregister(service)
err := ocisRegistry.Deregister(service)
if err != nil {
logger.Err(err).Msgf("Error unregistering external service %v", serviceID)
}
Expand Down