Skip to content

Commit

Permalink
Just hammer those requests in
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwoth committed Aug 4, 2016
1 parent e3fd2b9 commit 4379117
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Discord.Net/MessageQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,24 @@ private Task RunSendQueue(CancellationToken cancelToken)
Nonce = msg.Nonce.ToString(),
IsTTS = msg.IsTTS
};
var response = await _rest.Send(request).ConfigureAwait(false);
msg.State = MessageState.Normal;
msg.Id = response.Id;
msg.Update(response);
#pragma warning disable
_rest.Send(request).ContinueWith((t, msgObj) =>
{
var localMsg = msgObj as Message;
if (t.Status == TaskStatus.RanToCompletion)
{
var x = t.Result;
localMsg.State = MessageState.Normal;
localMsg.Id = x.Id;
localMsg.Update(x);
}
else
{
localMsg.State = MessageState.Failed;
_logger.Error($"Failed to send message to {localMsg.Channel.Path}", t.Exception);
}
}, msg);
#pragma warning restore
}
catch (Exception ex)
{
Expand Down

0 comments on commit 4379117

Please sign in to comment.