Skip to content

Commit

Permalink
Merge pull request #43 from alejogagliardi/development
Browse files Browse the repository at this point in the history
RunSynchronously exception on RESTActionConsumer.cs. Changed to use GetAwaiter.GetResult()
  • Loading branch information
skrusty authored Aug 8, 2017
2 parents 883e5e8 + 0b64bbb commit 0babcfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions AsterNET.ARI/ARIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void Dispose()

#region Private and Protected Methods


private void _eventProducer_OnConnectionStateChanged(object sender, EventArgs e)
{
if (_eventProducer.State != ConnectionState.Open)
Expand Down Expand Up @@ -153,10 +154,10 @@ private void _eventProducer_OnMessageReceived(object sender, MessageEventArgs e)
{
FireEvent(evnt.Type, evnt, this);
}
catch
catch(Exception ex)
{
// Handle any exceptions that were thrown by the invoked event handler
Console.WriteLine("An event listener went kaboom!");
Console.WriteLine("The event listener " + evnt.Type.ToString() + " cause an exeption: " + ex.Message );
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions AsterNET.ARI/Middleware/Default/RESTActionConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public IRestCommand GetRestCommand(HttpMethod method, string path)
{
var cmd = (Command) command;
var result = cmd.Client.Execute<T>(cmd.Request);
result.RunSynchronously();

//result.RunSynchronously();
result.GetAwaiter().GetResult();
var rtn = new CommandResult<T> {StatusCode = result.Result.StatusCode, Data = result.Result.Data};

return rtn;
Expand All @@ -36,8 +36,8 @@ public IRestCommandResult ProcessRestCommand(IRestCommand command)
{
var cmd = (Command) command;
var result = cmd.Client.Execute(cmd.Request);
result.RunSynchronously();

//result.RunSynchronously();
result.GetAwaiter().GetResult();
var rtn = new CommandResult {StatusCode = result.Result.StatusCode, RawData = result.Result.RawBytes};

return rtn;
Expand Down

0 comments on commit 0babcfa

Please sign in to comment.