Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Add missing await and add ConfigureAwait(false) calls #2548

Merged
merged 2 commits into from
Sep 11, 2016
Merged

Add missing await and add ConfigureAwait(false) calls #2548

merged 2 commits into from
Sep 11, 2016

Conversation

xt0rted
Copy link
Contributor

@xt0rted xt0rted commented Aug 30, 2016

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the Nancy code style guidelines
  • I have provided test coverage for my change (where applicable)

Description

This is a fix for #2471 along with some missing this.'s.

I wasn't sure if the call to Process() on line 134 was supposed to be awaited or not. Trying out the self host demo worked but that was as far as I went (I'm not familiar with the self host project).

@thecodejunkie thecodejunkie added this to the 2.0-clinteastwood milestone Aug 31, 2016
@jchannon jchannon merged commit 4c48f54 into NancyFx:master Sep 11, 2016
@jchannon
Copy link
Member

👍 Thanks ❤️

@xt0rted xt0rted deleted the issue-2471 branch September 11, 2016 15:57
@davidallyoung
Copy link
Contributor

@jchannon Does this make it so that the nancy self host will really only process one request at a time since it awaits on the Process call? Previously it would have just executed a hot task and forgotten about it and went back into the GetContextAsync loop. Does the fact that the httpListner.GetContextAsync is returned in its own execution thread change how await works?

Code referenced: 4c48f54#diff-f6b50509473947354cba195b3180ca10R134

@jchannon
Copy link
Member

ping @xt0rted @NancyFx/most-valued-minions

@jchannon
Copy link
Member

@davidallyoung No I dont believe so, its just saying it doesn't need the original context in which its executed

@davidallyoung
Copy link
Contributor

@jchannon Yeah I think it's good that the call to GetContextAsync was CAF'd, but I really feel like the await on this.Process is going to prevent the NancyHost from processing more than one request at a time as it'll block loop execution until Process completes. The current release of SelfHosting (1.4.1) package is using the async event callbacks on the httpListener so it's not affecting consumers of the package. I can submit a PR removing the await if that's a better way to have the conversation, just let me know!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants