Aaronontheweb on dev
Added v1.4.16 placeholder for n… (compare)
AwaitTermination
after the Shutdown
call fixes it both in 1.0.4 and 1.0.5 if I stop it gracefully. When killing it hard, even in 1.0.5 the behavior is same though. Of course when under my control I can try to gracefully close it down, but what if it crashes on me and gets restarted automatically ?
using (var client = new HttpClient())
{
var request = new HttpRequestMessage(msg.HttpMethod, msg.Uri);
client
.SendAsync(request)
.PipeTo(Self);
}
@mmisztal1980 you can create a custom response wrapper in SendAsync
continuation like:
using (var client = new HttpClient())
{
var request = new HttpRequestMessage(msg.HttpMethod, msg.Uri);
var start = DateTime.UtcNow;
client
.SendAsync(request)
.ContinueWith(task => !(task.IsCancelled || task.IsFaulted) ? new SuccessfulResponse(task.Result, start: start, stop: DateTime.UtcNow) : new FailedResponse(task.Result, start: start, stop: DateTime.UtcNow) ,
TaskContinuationOptions.AttachedToParent|TaskContinuationOptions.ExecuteSynchronously)
.PipeTo(Self);
}
Task continuation options are used here to not spawn separate tasks for one simple operation (creating message wrapper), we attach it to task running SendAsync instead.
dev
due to a merge conflict - asked you to do a rebase on dev a couple of weeks ago and never heard back