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)) {