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

try to make client when node is not available #538

Merged
merged 1 commit into from
Jan 18, 2022
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
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