Skip to content

Commit

Permalink
try to make client when node is not available (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
DuodenumL authored Jan 18, 2022
1 parent dfef999 commit 0f54c24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion engine/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
)

func getEngineCacheKey(endpoint, ca, cert, key string) string {
return endpoint + utils.SHA256(fmt.Sprintf(":%v:%v:%v", ca, cert, key))[:8]
return endpoint + "-" + utils.SHA256(fmt.Sprintf(":%v:%v:%v", ca, cert, key))[:8]
}

// EngineCacheChecker checks if the engine in cache is available
Expand Down
10 changes: 4 additions & 6 deletions store/etcdv3/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,10 @@ func (m *Mercury) doGetNodes(ctx context.Context, kvs []*mvccpb.KeyValue, labels
}

nodeChan <- node
if node.Available {
if client, err := m.makeClient(ctx, node); err != nil {
log.Errorf(ctx, "[doGetNodes] failed to make client for %v, err: %v", node.Name, err)
} else {
node.Engine = client
}
if client, err := m.makeClient(ctx, node); err != nil {
log.Errorf(ctx, "[doGetNodes] failed to make client for %v, err: %v", node.Name, err)
} else {
node.Engine = client
}
})
}
Expand Down
10 changes: 4 additions & 6 deletions store/redis/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,10 @@ func (r *Rediaron) doGetNodes(ctx context.Context, kvs map[string]string, labels
}

nodeChan <- node
if node.Available {
if client, err := r.makeClient(ctx, node); err != nil {
log.Errorf(ctx, "[doGetNodes] failed to make client for %v, err: %v", node.Name, err)
} else {
node.Engine = client
}
if client, err := r.makeClient(ctx, node); err != nil {
log.Errorf(ctx, "[doGetNodes] failed to make client for %v, err: %v", node.Name, err)
} else {
node.Engine = client
}
})
}
Expand Down

0 comments on commit 0f54c24

Please sign in to comment.