Skip to content

Commit 6667483

Browse files
ad-astra-videorickstaa
authored andcommitted
skip orchestrator info request if orch has no service uri set
1 parent 53734a4 commit 6667483

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

discovery/db_discovery.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
265265
return fmt.Errorf("could not retrieve orchestrators from DB: %v", err)
266266
}
267267

268-
resc, errc := make(chan *common.DBOrch, len(orchs)), make(chan error, len(orchs))
268+
resc, errc, skipped := make(chan *common.DBOrch, len(orchs)), make(chan error, len(orchs)), make(chan int, len(orchs))
269269
timeout := getOrchestratorTimeoutLoop //needs to be same or longer than GRPCConnectTimeout in server/rpc.go
270270
ctx, cancel := context.WithTimeout(context.Background(), timeout)
271271
defer cancel()
@@ -276,7 +276,11 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
276276
errc <- err
277277
return
278278
}
279-
279+
//do not connect if URI host is not set
280+
if uri.Host == "" {
281+
skipped <- 1
282+
return
283+
}
280284
info, err := serverGetOrchInfo(ctx, dbo.bcast, uri, nil)
281285
if err != nil {
282286
errc <- err
@@ -311,6 +315,7 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
311315
}
312316

313317
numOrchs := 0
318+
skippedOrchs := 0
314319
for _, orch := range orchs {
315320
if orch == nil {
316321
continue
@@ -325,10 +330,12 @@ func (dbo *DBOrchestratorPoolCache) cacheDBOrchs() error {
325330
if err := dbo.store.UpdateOrch(res); err != nil {
326331
glog.Error("Error updating Orchestrator in DB: ", err)
327332
}
333+
case <-skipped:
334+
skippedOrchs += 1
328335
case err := <-errc:
329336
glog.Errorln(err)
330337
case <-ctx.Done():
331-
glog.Info("Done fetching orch info for orchestrators, context timeout")
338+
glog.Infof("Done fetching orch info for orchestrators, context timeout (skipped: %v)", skippedOrchs)
332339
return nil
333340
}
334341
}

0 commit comments

Comments
 (0)