Commit 6a40cedf authored by Nick Craver's avatar Nick Craver

Move cluster config fetch to async

Resolves #337
parent b60c5568
...@@ -1320,7 +1320,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text ...@@ -1320,7 +1320,7 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
// so we will get list of other nodes from this server using "CLUSTER NODES" command // so we will get list of other nodes from this server using "CLUSTER NODES" command
// and try to connect to these other nodes in the next iteration // and try to connect to these other nodes in the next iteration
encounteredConnectedClusterServer = true; encounteredConnectedClusterServer = true;
updatedClusterEndpointCollection = GetEndpointsFromClusterNodes(server, log); updatedClusterEndpointCollection = await GetEndpointsFromClusterNodes(server, log);
} }
// set the server UnselectableFlags and update masters list // set the server UnselectableFlags and update masters list
...@@ -1473,13 +1473,12 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text ...@@ -1473,13 +1473,12 @@ internal async Task<bool> ReconfigureAsync(bool first, bool reconfigureAll, Text
} }
} }
private EndPointCollection GetEndpointsFromClusterNodes(ServerEndPoint server, TextWriter log) private async Task<EndPointCollection> GetEndpointsFromClusterNodes(ServerEndPoint server, TextWriter log)
{ {
var message = Message.Create(-1, CommandFlags.None, RedisCommand.CLUSTER, RedisLiterals.NODES); var message = Message.Create(-1, CommandFlags.None, RedisCommand.CLUSTER, RedisLiterals.NODES);
ClusterConfiguration clusterConfig = null;
try try
{ {
clusterConfig = this.ExecuteSyncImpl(message, ResultProcessor.ClusterNodes, server); var clusterConfig = await ExecuteAsyncImpl(message, ResultProcessor.ClusterNodes, null, server);
return new EndPointCollection(clusterConfig.Nodes.Select(node => node.EndPoint).ToList()); return new EndPointCollection(clusterConfig.Nodes.Select(node => node.EndPoint).ToList());
} }
catch (Exception ex) catch (Exception ex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment