{"action":"created","comment":{"url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/comments/37427326","id":37427326,"diff_hunk":"@@ -133,25 +134,29 @@ private Task<byte[]> EnqueueReadTask(int readSize, CancellationToken cancellatio\n             return readTask.Tcp.Task;\n         }\n \n-        private void DedicatedSocketTask()\n+        private async Task DedicatedSocketTask()\n         {\n             while (_disposeToken.IsCancellationRequested == false)\n             {\n                 try\n                 {\n                     //block here until we can get connections then start loop pushing data through network stream\n-                    var netStream = GetStreamAsync().Result;\n \n-                    ProcessNetworkstreamTasks(netStream);\n+                    var netStreamTask = GetStreamAsync();\n+                    await Task.WhenAny(_disposeTask, netStreamTask).ConfigureAwait(false);\n+                    if (_disposeToken.IsCancellationRequested)\n+                    {\n+                        setDisposeExceptonToPenndingTask();\n+                        return;\n+                    }\n+                    var netStream = await netStreamTask; //all reday done\n+                    await ProcessNetworkstreamTasks(netStream).ConfigureAwait(false);\n                 }\n                 catch (Exception ex)\n                 {\n                     if (_disposeToken.IsCancellationRequested)\n                     {\n-                        _log.WarnFormat(\"KafkaTcpSocket thread shutting down because of a dispose call.\");\n-                        var disposeException = new ObjectDisposedException(\"Object is disposing.\");\n-                        _sendTaskQueue.DrainAndApply(t => t.Tcp.TrySetException(disposeException));\n-                        _readTaskQueue.DrainAndApply(t => t.Tcp.TrySetException(disposeException));\n+                        setDisposeExceptonToPenndingTask();","path":"src/kafka-net/KafkaTcpSocket.cs","position":109,"original_position":61,"commit_id":"410b59146b763a68ac14f1d4fa9f5170db58ce3e","original_commit_id":"01fff7a0ec195b00ad4d8864e73cbd5dc3b631f1","user":{"login":"randa1","id":3209338,"avatar_url":"https://avatars.githubusercontent.com/u/3209338?v=3","gravatar_id":"","url":"https://api.github.com/users/randa1","html_url":"https://github.com/randa1","followers_url":"https://api.github.com/users/randa1/followers","following_url":"https://api.github.com/users/randa1/following{/other_user}","gists_url":"https://api.github.com/users/randa1/gists{/gist_id}","starred_url":"https://api.github.com/users/randa1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randa1/subscriptions","organizations_url":"https://api.github.com/users/randa1/orgs","repos_url":"https://api.github.com/users/randa1/repos","events_url":"https://api.github.com/users/randa1/events{/privacy}","received_events_url":"https://api.github.com/users/randa1/received_events","type":"User","site_admin":false},"body":"should start with capital letter","created_at":"2015-08-19T15:21:53Z","updated_at":"2015-08-19T15:21:53Z","html_url":"https://github.com/gigya/KafkaNetClient/pull/3#discussion_r37427326","pull_request_url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/comments/37427326"},"html":{"href":"https://github.com/gigya/KafkaNetClient/pull/3#discussion_r37427326"},"pull_request":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3","id":42576090,"html_url":"https://github.com/gigya/KafkaNetClient/pull/3","diff_url":"https://github.com/gigya/KafkaNetClient/pull/3.diff","patch_url":"https://github.com/gigya/KafkaNetClient/pull/3.patch","issue_url":"https://api.github.com/repos/gigya/KafkaNetClient/issues/3","number":3,"state":"open","locked":false,"title":"Improve performance async","user":{"login":"EranOfer","id":13414515,"avatar_url":"https://avatars.githubusercontent.com/u/13414515?v=3","gravatar_id":"","url":"https://api.github.com/users/EranOfer","html_url":"https://github.com/EranOfer","followers_url":"https://api.github.com/users/EranOfer/followers","following_url":"https://api.github.com/users/EranOfer/following{/other_user}","gists_url":"https://api.github.com/users/EranOfer/gists{/gist_id}","starred_url":"https://api.github.com/users/EranOfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EranOfer/subscriptions","organizations_url":"https://api.github.com/users/EranOfer/orgs","repos_url":"https://api.github.com/users/EranOfer/repos","events_url":"https://api.github.com/users/EranOfer/events{/privacy}","received_events_url":"https://api.github.com/users/EranOfer/received_events","type":"User","site_admin":false},"body":"convert all the code to async.\r\nmake the unitest more reliable.\r\nadd manual consumer .\r\nchange refresh metadata function and behavior.\r\nfix dispose bug.\r\nadd load test.\r\n----\r\nMajor changes in class:\r\nKafkaTcpSocket\r\nProducer\r\nProtocolGateway-(look on FakeProtocolGatewayTest for more details)\r\nKafkaConnection\r\nBrokerRouter\r\nConsumer\r\nMetadataQueries\r\nKafkaMetadataProvider\r\n\r\n\r\n\r\n\r\n","created_at":"2015-08-17T10:59:18Z","updated_at":"2015-08-19T15:21:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7fd74d5bfa11cd564a8f084538b626d2fa4289f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3/commits","review_comments_url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3/comments","review_comment_url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gigya/KafkaNetClient/issues/3/comments","statuses_url":"https://api.github.com/repos/gigya/KafkaNetClient/statuses/410b59146b763a68ac14f1d4fa9f5170db58ce3e","head":{"label":"EranOfer:ImprovePreformance_AsyncTest","ref":"ImprovePreformance_AsyncTest","sha":"410b59146b763a68ac14f1d4fa9f5170db58ce3e","user":{"login":"EranOfer","id":13414515,"avatar_url":"https://avatars.githubusercontent.com/u/13414515?v=3","gravatar_id":"","url":"https://api.github.com/users/EranOfer","html_url":"https://github.com/EranOfer","followers_url":"https://api.github.com/users/EranOfer/followers","following_url":"https://api.github.com/users/EranOfer/following{/other_user}","gists_url":"https://api.github.com/users/EranOfer/gists{/gist_id}","starred_url":"https://api.github.com/users/EranOfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EranOfer/subscriptions","organizations_url":"https://api.github.com/users/EranOfer/orgs","repos_url":"https://api.github.com/users/EranOfer/repos","events_url":"https://api.github.com/users/EranOfer/events{/privacy}","received_events_url":"https://api.github.com/users/EranOfer/received_events","type":"User","site_admin":false},"repo":{"id":39838171,"name":"kafka-net","full_name":"EranOfer/kafka-net","owner":{"login":"EranOfer","id":13414515,"avatar_url":"https://avatars.githubusercontent.com/u/13414515?v=3","gravatar_id":"","url":"https://api.github.com/users/EranOfer","html_url":"https://github.com/EranOfer","followers_url":"https://api.github.com/users/EranOfer/followers","following_url":"https://api.github.com/users/EranOfer/following{/other_user}","gists_url":"https://api.github.com/users/EranOfer/gists{/gist_id}","starred_url":"https://api.github.com/users/EranOfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EranOfer/subscriptions","organizations_url":"https://api.github.com/users/EranOfer/orgs","repos_url":"https://api.github.com/users/EranOfer/repos","events_url":"https://api.github.com/users/EranOfer/events{/privacy}","received_events_url":"https://api.github.com/users/EranOfer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/EranOfer/kafka-net","description":"Native C# client for Kafka queue servers.","fork":true,"url":"https://api.github.com/repos/EranOfer/kafka-net","forks_url":"https://api.github.com/repos/EranOfer/kafka-net/forks","keys_url":"https://api.github.com/repos/EranOfer/kafka-net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EranOfer/kafka-net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EranOfer/kafka-net/teams","hooks_url":"https://api.github.com/repos/EranOfer/kafka-net/hooks","issue_events_url":"https://api.github.com/repos/EranOfer/kafka-net/issues/events{/number}","events_url":"https://api.github.com/repos/EranOfer/kafka-net/events","assignees_url":"https://api.github.com/repos/EranOfer/kafka-net/assignees{/user}","branches_url":"https://api.github.com/repos/EranOfer/kafka-net/branches{/branch}","tags_url":"https://api.github.com/repos/EranOfer/kafka-net/tags","blobs_url":"https://api.github.com/repos/EranOfer/kafka-net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EranOfer/kafka-net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EranOfer/kafka-net/git/refs{/sha}","trees_url":"https://api.github.com/repos/EranOfer/kafka-net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EranOfer/kafka-net/statuses/{sha}","languages_url":"https://api.github.com/repos/EranOfer/kafka-net/languages","stargazers_url":"https://api.github.com/repos/EranOfer/kafka-net/stargazers","contributors_url":"https://api.github.com/repos/EranOfer/kafka-net/contributors","subscribers_url":"https://api.github.com/repos/EranOfer/kafka-net/subscribers","subscription_url":"https://api.github.com/repos/EranOfer/kafka-net/subscription","commits_url":"https://api.github.com/repos/EranOfer/kafka-net/commits{/sha}","git_commits_url":"https://api.github.com/repos/EranOfer/kafka-net/git/commits{/sha}","comments_url":"https://api.github.com/repos/EranOfer/kafka-net/comments{/number}","issue_comment_url":"https://api.github.com/repos/EranOfer/kafka-net/issues/comments{/number}","contents_url":"https://api.github.com/repos/EranOfer/kafka-net/contents/{+path}","compare_url":"https://api.github.com/repos/EranOfer/kafka-net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EranOfer/kafka-net/merges","archive_url":"https://api.github.com/repos/EranOfer/kafka-net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EranOfer/kafka-net/downloads","issues_url":"https://api.github.com/repos/EranOfer/kafka-net/issues{/number}","pulls_url":"https://api.github.com/repos/EranOfer/kafka-net/pulls{/number}","milestones_url":"https://api.github.com/repos/EranOfer/kafka-net/milestones{/number}","notifications_url":"https://api.github.com/repos/EranOfer/kafka-net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EranOfer/kafka-net/labels{/name}","releases_url":"https://api.github.com/repos/EranOfer/kafka-net/releases{/id}","created_at":"2015-07-28T14:18:23Z","updated_at":"2015-08-19T14:32:15Z","pushed_at":"2015-08-19T14:24:58Z","git_url":"git://github.com/EranOfer/kafka-net.git","ssh_url":"git@github.com:EranOfer/kafka-net.git","clone_url":"https://github.com/EranOfer/kafka-net.git","svn_url":"https://github.com/EranOfer/kafka-net","homepage":null,"size":10939,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gigya:master","ref":"master","sha":"50cf88951c16293d8e8093184095f1cc2271c0a7","user":{"login":"gigya","id":3179803,"avatar_url":"https://avatars.githubusercontent.com/u/3179803?v=3","gravatar_id":"","url":"https://api.github.com/users/gigya","html_url":"https://github.com/gigya","followers_url":"https://api.github.com/users/gigya/followers","following_url":"https://api.github.com/users/gigya/following{/other_user}","gists_url":"https://api.github.com/users/gigya/gists{/gist_id}","starred_url":"https://api.github.com/users/gigya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gigya/subscriptions","organizations_url":"https://api.github.com/users/gigya/orgs","repos_url":"https://api.github.com/users/gigya/repos","events_url":"https://api.github.com/users/gigya/events{/privacy}","received_events_url":"https://api.github.com/users/gigya/received_events","type":"Organization","site_admin":false},"repo":{"id":39821531,"name":"KafkaNetClient","full_name":"gigya/KafkaNetClient","owner":{"login":"gigya","id":3179803,"avatar_url":"https://avatars.githubusercontent.com/u/3179803?v=3","gravatar_id":"","url":"https://api.github.com/users/gigya","html_url":"https://github.com/gigya","followers_url":"https://api.github.com/users/gigya/followers","following_url":"https://api.github.com/users/gigya/following{/other_user}","gists_url":"https://api.github.com/users/gigya/gists{/gist_id}","starred_url":"https://api.github.com/users/gigya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gigya/subscriptions","organizations_url":"https://api.github.com/users/gigya/orgs","repos_url":"https://api.github.com/users/gigya/repos","events_url":"https://api.github.com/users/gigya/events{/privacy}","received_events_url":"https://api.github.com/users/gigya/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gigya/KafkaNetClient","description":"Native C# client for Kafka queue servers.","fork":true,"url":"https://api.github.com/repos/gigya/KafkaNetClient","forks_url":"https://api.github.com/repos/gigya/KafkaNetClient/forks","keys_url":"https://api.github.com/repos/gigya/KafkaNetClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gigya/KafkaNetClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gigya/KafkaNetClient/teams","hooks_url":"https://api.github.com/repos/gigya/KafkaNetClient/hooks","issue_events_url":"https://api.github.com/repos/gigya/KafkaNetClient/issues/events{/number}","events_url":"https://api.github.com/repos/gigya/KafkaNetClient/events","assignees_url":"https://api.github.com/repos/gigya/KafkaNetClient/assignees{/user}","branches_url":"https://api.github.com/repos/gigya/KafkaNetClient/branches{/branch}","tags_url":"https://api.github.com/repos/gigya/KafkaNetClient/tags","blobs_url":"https://api.github.com/repos/gigya/KafkaNetClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gigya/KafkaNetClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gigya/KafkaNetClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/gigya/KafkaNetClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gigya/KafkaNetClient/statuses/{sha}","languages_url":"https://api.github.com/repos/gigya/KafkaNetClient/languages","stargazers_url":"https://api.github.com/repos/gigya/KafkaNetClient/stargazers","contributors_url":"https://api.github.com/repos/gigya/KafkaNetClient/contributors","subscribers_url":"https://api.github.com/repos/gigya/KafkaNetClient/subscribers","subscription_url":"https://api.github.com/repos/gigya/KafkaNetClient/subscription","commits_url":"https://api.github.com/repos/gigya/KafkaNetClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/gigya/KafkaNetClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/gigya/KafkaNetClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/gigya/KafkaNetClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/gigya/KafkaNetClient/contents/{+path}","compare_url":"https://api.github.com/repos/gigya/KafkaNetClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gigya/KafkaNetClient/merges","archive_url":"https://api.github.com/repos/gigya/KafkaNetClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gigya/KafkaNetClient/downloads","issues_url":"https://api.github.com/repos/gigya/KafkaNetClient/issues{/number}","pulls_url":"https://api.github.com/repos/gigya/KafkaNetClient/pulls{/number}","milestones_url":"https://api.github.com/repos/gigya/KafkaNetClient/milestones{/number}","notifications_url":"https://api.github.com/repos/gigya/KafkaNetClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gigya/KafkaNetClient/labels{/name}","releases_url":"https://api.github.com/repos/gigya/KafkaNetClient/releases{/id}","created_at":"2015-07-28T08:14:57Z","updated_at":"2015-08-19T08:46:26Z","pushed_at":"2015-08-19T14:24:59Z","git_url":"git://github.com/gigya/KafkaNetClient.git","ssh_url":"git@github.com:gigya/KafkaNetClient.git","clone_url":"https://github.com/gigya/KafkaNetClient.git","svn_url":"https://github.com/gigya/KafkaNetClient","homepage":null,"size":10998,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3"},"html":{"href":"https://github.com/gigya/KafkaNetClient/pull/3"},"issue":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/issues/3"},"comments":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/gigya/KafkaNetClient/statuses/410b59146b763a68ac14f1d4fa9f5170db58ce3e"}}}}