Skip to content

Switch to use the actual async execute method. #11

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 8 additions & 6 deletions src/RedisGraphDotNet.Client/RedisGraphClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ public RedisGraphClient(ConnectionMultiplexer multiplexer)
this.multiplexer = multiplexer;
}

public Task<ResultSet> Query(string graphName, string query)
public async Task<ResultSet> 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<string> Explain(string graphName, string query)
public async Task<string> 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<bool> DeleteGraph(string graphName) {
Expand All @@ -34,12 +36,12 @@ public Task<bool> DeleteGraph(string graphName) {
return Task.FromResult(true);
}

private RedisResult ExecuteQuery(string commandName, string graphName, string query)
private Task<RedisResult> 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))
{
Expand Down