{"action":"created","comment":{"url":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments/47888674","id":47888674,"diff_hunk":"@@ -50,113 +49,19 @@ public BeforePipeline(int capacity)\n             return pipelineToAddTo;\r\n         }\r\n \r\n-        public Task<Response> Invoke(NancyContext context, CancellationToken cancellationToken)\r\n+        public async Task<Response> Invoke(NancyContext context, CancellationToken cancellationToken)\r\n         {\r\n-            var tcs = new TaskCompletionSource<Response>();\r\n-\r\n             var enumerator = this.PipelineDelegates.GetEnumerator();\r\n \r\n-            if (enumerator.MoveNext())\r\n-            {\r\n-                ExecuteTasksWithSingleResultInternal(context, cancellationToken, enumerator, tcs);\r\n-            }\r\n-            else\r\n-            {\r\n-                tcs.SetResult(null);\r\n-            }\r\n-\r\n-            return tcs.Task;\r\n-        }\r\n-\r\n-        private static void ExecuteTasksWithSingleResultInternal(NancyContext context, CancellationToken cancellationToken, IEnumerator<Func<NancyContext, CancellationToken, Task<Response>>> enumerator, TaskCompletionSource<Response> tcs)\r\n-        {\r\n-            // Endless loop to try and optimise the \"main\" use case of\r\n-            // our tasks just being delegates wrapped in a task.\r\n-            //\r\n-            // If they finish executing before returning them we will\r\n-            // just loop around this while loop running them one by one,\r\n-            // as soon as we have to return, or a task is actually async,\r\n-            // then we will bale out and set a continuation.\r\n-            while (true)\r\n+            while (enumerator.MoveNext())\r","path":"src/Nancy/BeforePipeline.cs","position":41,"original_position":41,"commit_id":"8527004b521af7ded0c5b1e373fce2a1c491795b","original_commit_id":"8527004b521af7ded0c5b1e373fce2a1c491795b","user":{"login":"horsdal","id":676126,"avatar_url":"https://avatars.githubusercontent.com/u/676126?v=3","gravatar_id":"","url":"https://api.github.com/users/horsdal","html_url":"https://github.com/horsdal","followers_url":"https://api.github.com/users/horsdal/followers","following_url":"https://api.github.com/users/horsdal/following{/other_user}","gists_url":"https://api.github.com/users/horsdal/gists{/gist_id}","starred_url":"https://api.github.com/users/horsdal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/horsdal/subscriptions","organizations_url":"https://api.github.com/users/horsdal/orgs","repos_url":"https://api.github.com/users/horsdal/repos","events_url":"https://api.github.com/users/horsdal/events{/privacy}","received_events_url":"https://api.github.com/users/horsdal/received_events","type":"User","site_admin":false},"body":"do.","created_at":"2015-12-17T10:11:07Z","updated_at":"2015-12-17T10:11:07Z","html_url":"https://github.com/NancyFx/Nancy/pull/2105#discussion_r47888674","pull_request_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105","_links":{"self":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments/47888674"},"html":{"href":"https://github.com/NancyFx/Nancy/pull/2105#discussion_r47888674"},"pull_request":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105"}}},"pull_request":{"url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105","id":50307113,"html_url":"https://github.com/NancyFx/Nancy/pull/2105","diff_url":"https://github.com/NancyFx/Nancy/pull/2105.diff","patch_url":"https://github.com/NancyFx/Nancy/pull/2105.patch","issue_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2105","number":2105,"state":"open","locked":false,"title":"Using async/await","user":{"login":"damianh","id":57436,"avatar_url":"https://avatars.githubusercontent.com/u/57436?v=3","gravatar_id":"","url":"https://api.github.com/users/damianh","html_url":"https://github.com/damianh","followers_url":"https://api.github.com/users/damianh/followers","following_url":"https://api.github.com/users/damianh/following{/other_user}","gists_url":"https://api.github.com/users/damianh/gists{/gist_id}","starred_url":"https://api.github.com/users/damianh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianh/subscriptions","organizations_url":"https://api.github.com/users/damianh/orgs","repos_url":"https://api.github.com/users/damianh/repos","events_url":"https://api.github.com/users/damianh/events{/privacy}","received_events_url":"https://api.github.com/users/damianh/received_events","type":"User","site_admin":false},"body":"Removes the .net 4.0 era TPL code and uses .net 4.5's async / await.","created_at":"2015-11-10T20:33:41Z","updated_at":"2015-12-17T10:11:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"118f0c85a4034fbbd91540ae69cf1011552c77db","assignee":{"login":"grumpydev","id":527013,"avatar_url":"https://avatars.githubusercontent.com/u/527013?v=3","gravatar_id":"","url":"https://api.github.com/users/grumpydev","html_url":"https://github.com/grumpydev","followers_url":"https://api.github.com/users/grumpydev/followers","following_url":"https://api.github.com/users/grumpydev/following{/other_user}","gists_url":"https://api.github.com/users/grumpydev/gists{/gist_id}","starred_url":"https://api.github.com/users/grumpydev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grumpydev/subscriptions","organizations_url":"https://api.github.com/users/grumpydev/orgs","repos_url":"https://api.github.com/users/grumpydev/repos","events_url":"https://api.github.com/users/grumpydev/events{/privacy}","received_events_url":"https://api.github.com/users/grumpydev/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/NancyFx/Nancy/milestones/38","html_url":"https://github.com/NancyFx/Nancy/milestones/2.0","labels_url":"https://api.github.com/repos/NancyFx/Nancy/milestones/38/labels","id":965127,"number":38,"title":"2.0","description":"Authentication update to use the (horrible) .net 4.5 style ClaimsPrincipal.","creator":{"login":"grumpydev","id":527013,"avatar_url":"https://avatars.githubusercontent.com/u/527013?v=3","gravatar_id":"","url":"https://api.github.com/users/grumpydev","html_url":"https://github.com/grumpydev","followers_url":"https://api.github.com/users/grumpydev/followers","following_url":"https://api.github.com/users/grumpydev/following{/other_user}","gists_url":"https://api.github.com/users/grumpydev/gists{/gist_id}","starred_url":"https://api.github.com/users/grumpydev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grumpydev/subscriptions","organizations_url":"https://api.github.com/users/grumpydev/orgs","repos_url":"https://api.github.com/users/grumpydev/repos","events_url":"https://api.github.com/users/grumpydev/events{/privacy}","received_events_url":"https://api.github.com/users/grumpydev/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":39,"state":"open","created_at":"2015-02-04T09:08:48Z","updated_at":"2015-12-16T11:55:56Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105/commits","review_comments_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105/comments","review_comment_url":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2105/comments","statuses_url":"https://api.github.com/repos/NancyFx/Nancy/statuses/8527004b521af7ded0c5b1e373fce2a1c491795b","head":{"label":"damianh:async","ref":"async","sha":"8527004b521af7ded0c5b1e373fce2a1c491795b","user":{"login":"damianh","id":57436,"avatar_url":"https://avatars.githubusercontent.com/u/57436?v=3","gravatar_id":"","url":"https://api.github.com/users/damianh","html_url":"https://github.com/damianh","followers_url":"https://api.github.com/users/damianh/followers","following_url":"https://api.github.com/users/damianh/following{/other_user}","gists_url":"https://api.github.com/users/damianh/gists{/gist_id}","starred_url":"https://api.github.com/users/damianh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianh/subscriptions","organizations_url":"https://api.github.com/users/damianh/orgs","repos_url":"https://api.github.com/users/damianh/repos","events_url":"https://api.github.com/users/damianh/events{/privacy}","received_events_url":"https://api.github.com/users/damianh/received_events","type":"User","site_admin":false},"repo":{"id":7504568,"name":"Nancy","full_name":"damianh/Nancy","owner":{"login":"damianh","id":57436,"avatar_url":"https://avatars.githubusercontent.com/u/57436?v=3","gravatar_id":"","url":"https://api.github.com/users/damianh","html_url":"https://github.com/damianh","followers_url":"https://api.github.com/users/damianh/followers","following_url":"https://api.github.com/users/damianh/following{/other_user}","gists_url":"https://api.github.com/users/damianh/gists{/gist_id}","starred_url":"https://api.github.com/users/damianh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damianh/subscriptions","organizations_url":"https://api.github.com/users/damianh/orgs","repos_url":"https://api.github.com/users/damianh/repos","events_url":"https://api.github.com/users/damianh/events{/privacy}","received_events_url":"https://api.github.com/users/damianh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/damianh/Nancy","description":"Nancy is a lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono","fork":true,"url":"https://api.github.com/repos/damianh/Nancy","forks_url":"https://api.github.com/repos/damianh/Nancy/forks","keys_url":"https://api.github.com/repos/damianh/Nancy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/damianh/Nancy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/damianh/Nancy/teams","hooks_url":"https://api.github.com/repos/damianh/Nancy/hooks","issue_events_url":"https://api.github.com/repos/damianh/Nancy/issues/events{/number}","events_url":"https://api.github.com/repos/damianh/Nancy/events","assignees_url":"https://api.github.com/repos/damianh/Nancy/assignees{/user}","branches_url":"https://api.github.com/repos/damianh/Nancy/branches{/branch}","tags_url":"https://api.github.com/repos/damianh/Nancy/tags","blobs_url":"https://api.github.com/repos/damianh/Nancy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/damianh/Nancy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/damianh/Nancy/git/refs{/sha}","trees_url":"https://api.github.com/repos/damianh/Nancy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/damianh/Nancy/statuses/{sha}","languages_url":"https://api.github.com/repos/damianh/Nancy/languages","stargazers_url":"https://api.github.com/repos/damianh/Nancy/stargazers","contributors_url":"https://api.github.com/repos/damianh/Nancy/contributors","subscribers_url":"https://api.github.com/repos/damianh/Nancy/subscribers","subscription_url":"https://api.github.com/repos/damianh/Nancy/subscription","commits_url":"https://api.github.com/repos/damianh/Nancy/commits{/sha}","git_commits_url":"https://api.github.com/repos/damianh/Nancy/git/commits{/sha}","comments_url":"https://api.github.com/repos/damianh/Nancy/comments{/number}","issue_comment_url":"https://api.github.com/repos/damianh/Nancy/issues/comments{/number}","contents_url":"https://api.github.com/repos/damianh/Nancy/contents/{+path}","compare_url":"https://api.github.com/repos/damianh/Nancy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/damianh/Nancy/merges","archive_url":"https://api.github.com/repos/damianh/Nancy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/damianh/Nancy/downloads","issues_url":"https://api.github.com/repos/damianh/Nancy/issues{/number}","pulls_url":"https://api.github.com/repos/damianh/Nancy/pulls{/number}","milestones_url":"https://api.github.com/repos/damianh/Nancy/milestones{/number}","notifications_url":"https://api.github.com/repos/damianh/Nancy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/damianh/Nancy/labels{/name}","releases_url":"https://api.github.com/repos/damianh/Nancy/releases{/id}","created_at":"2013-01-08T16:06:59Z","updated_at":"2014-06-25T07:53:43Z","pushed_at":"2015-12-17T08:20:19Z","git_url":"git://github.com/damianh/Nancy.git","ssh_url":"git@github.com:damianh/Nancy.git","clone_url":"https://github.com/damianh/Nancy.git","svn_url":"https://github.com/damianh/Nancy","homepage":"http://nancyfx.org","size":28246,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NancyFx:master","ref":"master","sha":"894ac3f89ad985d61a340e1497ec5b2435a1c075","user":{"login":"NancyFx","id":706659,"avatar_url":"https://avatars.githubusercontent.com/u/706659?v=3","gravatar_id":"","url":"https://api.github.com/users/NancyFx","html_url":"https://github.com/NancyFx","followers_url":"https://api.github.com/users/NancyFx/followers","following_url":"https://api.github.com/users/NancyFx/following{/other_user}","gists_url":"https://api.github.com/users/NancyFx/gists{/gist_id}","starred_url":"https://api.github.com/users/NancyFx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NancyFx/subscriptions","organizations_url":"https://api.github.com/users/NancyFx/orgs","repos_url":"https://api.github.com/users/NancyFx/repos","events_url":"https://api.github.com/users/NancyFx/events{/privacy}","received_events_url":"https://api.github.com/users/NancyFx/received_events","type":"Organization","site_admin":false},"repo":{"id":738250,"name":"Nancy","full_name":"NancyFx/Nancy","owner":{"login":"NancyFx","id":706659,"avatar_url":"https://avatars.githubusercontent.com/u/706659?v=3","gravatar_id":"","url":"https://api.github.com/users/NancyFx","html_url":"https://github.com/NancyFx","followers_url":"https://api.github.com/users/NancyFx/followers","following_url":"https://api.github.com/users/NancyFx/following{/other_user}","gists_url":"https://api.github.com/users/NancyFx/gists{/gist_id}","starred_url":"https://api.github.com/users/NancyFx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NancyFx/subscriptions","organizations_url":"https://api.github.com/users/NancyFx/orgs","repos_url":"https://api.github.com/users/NancyFx/repos","events_url":"https://api.github.com/users/NancyFx/events{/privacy}","received_events_url":"https://api.github.com/users/NancyFx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NancyFx/Nancy","description":"Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono","fork":false,"url":"https://api.github.com/repos/NancyFx/Nancy","forks_url":"https://api.github.com/repos/NancyFx/Nancy/forks","keys_url":"https://api.github.com/repos/NancyFx/Nancy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NancyFx/Nancy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NancyFx/Nancy/teams","hooks_url":"https://api.github.com/repos/NancyFx/Nancy/hooks","issue_events_url":"https://api.github.com/repos/NancyFx/Nancy/issues/events{/number}","events_url":"https://api.github.com/repos/NancyFx/Nancy/events","assignees_url":"https://api.github.com/repos/NancyFx/Nancy/assignees{/user}","branches_url":"https://api.github.com/repos/NancyFx/Nancy/branches{/branch}","tags_url":"https://api.github.com/repos/NancyFx/Nancy/tags","blobs_url":"https://api.github.com/repos/NancyFx/Nancy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NancyFx/Nancy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NancyFx/Nancy/git/refs{/sha}","trees_url":"https://api.github.com/repos/NancyFx/Nancy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NancyFx/Nancy/statuses/{sha}","languages_url":"https://api.github.com/repos/NancyFx/Nancy/languages","stargazers_url":"https://api.github.com/repos/NancyFx/Nancy/stargazers","contributors_url":"https://api.github.com/repos/NancyFx/Nancy/contributors","subscribers_url":"https://api.github.com/repos/NancyFx/Nancy/subscribers","subscription_url":"https://api.github.com/repos/NancyFx/Nancy/subscription","commits_url":"https://api.github.com/repos/NancyFx/Nancy/commits{/sha}","git_commits_url":"https://api.github.com/repos/NancyFx/Nancy/git/commits{/sha}","comments_url":"https://api.github.com/repos/NancyFx/Nancy/comments{/number}","issue_comment_url":"https://api.github.com/repos/NancyFx/Nancy/issues/comments{/number}","contents_url":"https://api.github.com/repos/NancyFx/Nancy/contents/{+path}","compare_url":"https://api.github.com/repos/NancyFx/Nancy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NancyFx/Nancy/merges","archive_url":"https://api.github.com/repos/NancyFx/Nancy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NancyFx/Nancy/downloads","issues_url":"https://api.github.com/repos/NancyFx/Nancy/issues{/number}","pulls_url":"https://api.github.com/repos/NancyFx/Nancy/pulls{/number}","milestones_url":"https://api.github.com/repos/NancyFx/Nancy/milestones{/number}","notifications_url":"https://api.github.com/repos/NancyFx/Nancy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NancyFx/Nancy/labels{/name}","releases_url":"https://api.github.com/repos/NancyFx/Nancy/releases{/id}","created_at":"2010-06-24T19:35:22Z","updated_at":"2015-12-16T22:36:49Z","pushed_at":"2015-12-17T08:20:19Z","git_url":"git://github.com/NancyFx/Nancy.git","ssh_url":"git@github.com:NancyFx/Nancy.git","clone_url":"https://github.com/NancyFx/Nancy.git","svn_url":"https://github.com/NancyFx/Nancy","homepage":"http://nancyfx.org","size":51216,"stargazers_count":3563,"watchers_count":3563,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":942,"mirror_url":null,"open_issues_count":127,"forks":942,"open_issues":127,"watchers":3563,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105"},"html":{"href":"https://github.com/NancyFx/Nancy/pull/2105"},"issue":{"href":"https://api.github.com/repos/NancyFx/Nancy/issues/2105"},"comments":{"href":"https://api.github.com/repos/NancyFx/Nancy/issues/2105/comments"},"review_comments":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105/comments"},"review_comment":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NancyFx/Nancy/pulls/2105/commits"},"statuses":{"href":"https://api.github.com/repos/NancyFx/Nancy/statuses/8527004b521af7ded0c5b1e373fce2a1c491795b"}}}}