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

chore: skip orchestrator info requests if service uri not set by orchestrator #3149

Merged
Merged
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
12 changes: 8 additions & 4 deletions discovery/db_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (dbo *DBOrchestratorPoolCache) cacheOrchestratorStake() error {
}

resc, errc := make(chan *common.DBOrch, len(orchs)), make(chan error, len(orchs))
timeout := getOrchestratorTimeoutLoop //needs to be same or longer than GRPCConnectTimeout in server/rpc.go
timeout := getOrchestratorTimeoutLoop // Needs to be same or longer than GRPCConnectTimeout in server/rpc.go
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

Expand Down Expand Up @@ -266,7 +266,7 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
}

resc, errc := make(chan *common.DBOrch, len(orchs)), make(chan error, len(orchs))
timeout := getOrchestratorTimeoutLoop //needs to be same or longer than GRPCConnectTimeout in server/rpc.go
timeout := getOrchestratorTimeoutLoop // Needs to be same or longer than GRPCConnectTimeout in server/rpc.go
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

Expand All @@ -276,7 +276,11 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
errc <- err
return
}

// Do not connect if URI host is not set
if uri.Host == "" {
errc <- fmt.Errorf("skipping orch=%v, URI not set", dbOrch.EthereumAddr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victorges Should we throw this error, or would it be cleaner to simply display the fetched orchestrators? See @ad-astra-video's first solution (i.e. 6667483).

return
}
info, err := serverGetOrchInfo(ctx, dbo.bcast, uri, nil)
if err != nil {
errc <- err
Expand Down Expand Up @@ -328,7 +332,7 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
case err := <-errc:
glog.Errorln(err)
case <-ctx.Done():
glog.Info("Done fetching orch info for orchestrators, context timeout")
glog.Infof("Done fetching orch info for orchestrators, context timeout (fetched: %v out of %v)", i, numOrchs)
return nil
}
}
Expand Down
Loading