From 3e8e40d3775910b35a316fdfa819662ae5e569e8 Mon Sep 17 00:00:00 2001 From: NickStrupat Date: Sun, 14 Jun 2020 23:05:08 -0400 Subject: [PATCH] Switch to use the actual async execute method. --- src/RedisGraphDotNet.Client/RedisGraphClient.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/RedisGraphDotNet.Client/RedisGraphClient.cs b/src/RedisGraphDotNet.Client/RedisGraphClient.cs index bd366e2..0d91702 100644 --- a/src/RedisGraphDotNet.Client/RedisGraphClient.cs +++ b/src/RedisGraphDotNet.Client/RedisGraphClient.cs @@ -18,14 +18,16 @@ public RedisGraphClient(ConnectionMultiplexer multiplexer) this.multiplexer = multiplexer; } - public Task Query(string graphName, string query) + public async Task Query(string graphName, string query) { - return Task.FromResult(ExecuteQuery(RedisGraphQueryCommand, graphName, query).AsResultSet()); + var redisResult = await ExecuteQueryAsync(RedisGraphQueryCommand, graphName, query); + return redisResult.AsResultSet(); } - public Task Explain(string graphName, string query) + public async Task Explain(string graphName, string query) { - return Task.FromResult((string) ExecuteQuery(RedisGraphExplainCommand, graphName, query)); + var redisResult = await ExecuteQueryAsync(RedisGraphExplainCommand, graphName, query); + return (string) redisResult; } public Task DeleteGraph(string graphName) { @@ -34,12 +36,12 @@ public Task DeleteGraph(string graphName) { return Task.FromResult(true); } - private RedisResult ExecuteQuery(string commandName, string graphName, string query) + private Task ExecuteQueryAsync(string commandName, string graphName, string query) { try { var db = multiplexer.GetDatabase(); - return db.Execute(commandName, graphName, query); + return db.ExecuteAsync(commandName, graphName, query); } catch (RedisServerException ex) when (ex.Message.Contains(RedisGraphErrorMessages.GraphDatabaseNotExists)) {