{"action":"created","comment":{"url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/comments/38029671","id":38029671,"diff_hunk":"@@ -83,7 +91,76 @@ var _ = Describe(\"HttpsWriter\", func() {\n \t\t\tparsedTime, err := time.Parse(time.RFC3339, \"2006-01-02T15:04:05Z\")\n \t\t\t_, err = w.Write(standardErrorPriority, []byte(\"Message\"), \"just a test\", \"TEST\", parsedTime.UnixNano())\n \t\t\tExpect(err).ToNot(HaveOccurred())\n+\t\t})\n \n+\t\tDescribe(\"idle connection behavior\", func() {\n+\t\t\tvar (\n+\t\t\t\treceivedChan chan []byte\n+\t\t\t\twaitChan     chan struct{}\n+\t\t\t\tlistener     *historyListener\n+\t\t\t)\n+\n+\t\t\tBeforeEach(func() {\n+\t\t\t\treceivedChan = make(chan []byte, 1)\n+\t\t\t\twaitChan = make(chan struct{})\n+\n+\t\t\t\tl, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n+\t\t\t\tExpect(err).NotTo(HaveOccurred())\n+\n+\t\t\t\tlistener = &historyListener{Listener: l}\n+\t\t\t\tserver.Listener = listener\n+\n+\t\t\t\tslowHandler := func(_ http.ResponseWriter, r *http.Request) {\n+\t\t\t\t\tbody, _ := ioutil.ReadAll(r.Body)\n+\t\t\t\t\treceivedChan <- body\n+\n+\t\t\t\t\t<-waitChan\n+\t\t\t\t\tr.Body.Close()\n+\t\t\t\t}\n+\t\t\t\tserveMux.HandleFunc(\"/wait/\", slowHandler)\n+\t\t\t})\n+\n+\t\t\tIt(\"only keeps one idle connection\", func() {\n+\t\t\t\toutputUrl, err := url.Parse(server.URL + \"/wait/\")\n+\t\t\t\tExpect(err).NotTo(HaveOccurred())\n+\n+\t\t\t\tw, err := syslogwriter.NewHttpsWriter(outputUrl, \"appId\", true)\n+\t\t\t\tExpect(err).NotTo(HaveOccurred())\n+\n+\t\t\t\tcompletedReqs := make(chan struct{}, 2)\n+\t\t\t\tblockingRequest := func() {\n+\t\t\t\t\tdefer GinkgoRecover()\n+\t\t\t\t\t_, err := w.Write(standardErrorPriority, []byte(\"Message\"), \"just a test\", \"TEST\", time.Now().UnixNano())\n+\t\t\t\t\tExpect(err).NotTo(HaveOccurred())\n+\t\t\t\t\tEventually(completedReqs).Should(BeSent(struct{}{}))\n+\t\t\t\t}\n+\n+\t\t\t\tfor i := 0; i < 2; i++ {","path":"src/doppler/sinks/syslogwriter/https_writer_test.go","position":93,"original_position":93,"commit_id":"7b8457d02a56aca49ef19605381bc140e8988ca4","original_commit_id":"7b8457d02a56aca49ef19605381bc140e8988ca4","user":{"login":"dsabeti","id":898949,"avatar_url":"https://avatars.githubusercontent.com/u/898949?v=3","gravatar_id":"","url":"https://api.github.com/users/dsabeti","html_url":"https://github.com/dsabeti","followers_url":"https://api.github.com/users/dsabeti/followers","following_url":"https://api.github.com/users/dsabeti/following{/other_user}","gists_url":"https://api.github.com/users/dsabeti/gists{/gist_id}","starred_url":"https://api.github.com/users/dsabeti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsabeti/subscriptions","organizations_url":"https://api.github.com/users/dsabeti/orgs","repos_url":"https://api.github.com/users/dsabeti/repos","events_url":"https://api.github.com/users/dsabeti/events{/privacy}","received_events_url":"https://api.github.com/users/dsabeti/received_events","type":"User","site_admin":false},"body":"It looks like this code is duplicated below from [Line 151](https://github.com/cloudfoundry/loggregator/pull/70/files#diff-1faabae3338304697e132f3655dab4feR151) to [Line 159] (https://github.com/cloudfoundry/loggregator/pull/70/files#diff-1faabae3338304697e132f3655dab4feR159)","created_at":"2015-08-26T20:19:27Z","updated_at":"2015-08-26T20:19:27Z","html_url":"https://github.com/cloudfoundry/loggregator/pull/70#discussion_r38029671","pull_request_url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/comments/38029671"},"html":{"href":"https://github.com/cloudfoundry/loggregator/pull/70#discussion_r38029671"},"pull_request":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70","id":41253243,"html_url":"https://github.com/cloudfoundry/loggregator/pull/70","diff_url":"https://github.com/cloudfoundry/loggregator/pull/70.diff","patch_url":"https://github.com/cloudfoundry/loggregator/pull/70.patch","issue_url":"https://api.github.com/repos/cloudfoundry/loggregator/issues/70","number":70,"state":"open","locked":false,"title":"Set https syslog writer max idle connections to 1","user":{"login":"sykesm","id":4517909,"avatar_url":"https://avatars.githubusercontent.com/u/4517909?v=3","gravatar_id":"","url":"https://api.github.com/users/sykesm","html_url":"https://github.com/sykesm","followers_url":"https://api.github.com/users/sykesm/followers","following_url":"https://api.github.com/users/sykesm/following{/other_user}","gists_url":"https://api.github.com/users/sykesm/gists{/gist_id}","starred_url":"https://api.github.com/users/sykesm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sykesm/subscriptions","organizations_url":"https://api.github.com/users/sykesm/orgs","repos_url":"https://api.github.com/users/sykesm/repos","events_url":"https://api.github.com/users/sykesm/events{/privacy}","received_events_url":"https://api.github.com/users/sykesm/received_events","type":"User","site_admin":false},"body":"Since each https writer gets its own transport, the idle connection pools aren't shared. By setting the size to 1, we can ensure we don't get more than one connection.","created_at":"2015-07-30T16:20:31Z","updated_at":"2015-08-26T20:19:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71619805d3257796ad3aadf0176e8ddd7b6b2156","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70/commits","review_comments_url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70/comments","review_comment_url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudfoundry/loggregator/issues/70/comments","statuses_url":"https://api.github.com/repos/cloudfoundry/loggregator/statuses/7b8457d02a56aca49ef19605381bc140e8988ca4","head":{"label":"sykesm:max-idle-conns","ref":"max-idle-conns","sha":"7b8457d02a56aca49ef19605381bc140e8988ca4","user":{"login":"sykesm","id":4517909,"avatar_url":"https://avatars.githubusercontent.com/u/4517909?v=3","gravatar_id":"","url":"https://api.github.com/users/sykesm","html_url":"https://github.com/sykesm","followers_url":"https://api.github.com/users/sykesm/followers","following_url":"https://api.github.com/users/sykesm/following{/other_user}","gists_url":"https://api.github.com/users/sykesm/gists{/gist_id}","starred_url":"https://api.github.com/users/sykesm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sykesm/subscriptions","organizations_url":"https://api.github.com/users/sykesm/orgs","repos_url":"https://api.github.com/users/sykesm/repos","events_url":"https://api.github.com/users/sykesm/events{/privacy}","received_events_url":"https://api.github.com/users/sykesm/received_events","type":"User","site_admin":false},"repo":{"id":39901541,"name":"loggregator","full_name":"sykesm/loggregator","owner":{"login":"sykesm","id":4517909,"avatar_url":"https://avatars.githubusercontent.com/u/4517909?v=3","gravatar_id":"","url":"https://api.github.com/users/sykesm","html_url":"https://github.com/sykesm","followers_url":"https://api.github.com/users/sykesm/followers","following_url":"https://api.github.com/users/sykesm/following{/other_user}","gists_url":"https://api.github.com/users/sykesm/gists{/gist_id}","starred_url":"https://api.github.com/users/sykesm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sykesm/subscriptions","organizations_url":"https://api.github.com/users/sykesm/orgs","repos_url":"https://api.github.com/users/sykesm/repos","events_url":"https://api.github.com/users/sykesm/events{/privacy}","received_events_url":"https://api.github.com/users/sykesm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sykesm/loggregator","description":"Logging in the Clouds","fork":true,"url":"https://api.github.com/repos/sykesm/loggregator","forks_url":"https://api.github.com/repos/sykesm/loggregator/forks","keys_url":"https://api.github.com/repos/sykesm/loggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sykesm/loggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sykesm/loggregator/teams","hooks_url":"https://api.github.com/repos/sykesm/loggregator/hooks","issue_events_url":"https://api.github.com/repos/sykesm/loggregator/issues/events{/number}","events_url":"https://api.github.com/repos/sykesm/loggregator/events","assignees_url":"https://api.github.com/repos/sykesm/loggregator/assignees{/user}","branches_url":"https://api.github.com/repos/sykesm/loggregator/branches{/branch}","tags_url":"https://api.github.com/repos/sykesm/loggregator/tags","blobs_url":"https://api.github.com/repos/sykesm/loggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sykesm/loggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sykesm/loggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/sykesm/loggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sykesm/loggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/sykesm/loggregator/languages","stargazers_url":"https://api.github.com/repos/sykesm/loggregator/stargazers","contributors_url":"https://api.github.com/repos/sykesm/loggregator/contributors","subscribers_url":"https://api.github.com/repos/sykesm/loggregator/subscribers","subscription_url":"https://api.github.com/repos/sykesm/loggregator/subscription","commits_url":"https://api.github.com/repos/sykesm/loggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/sykesm/loggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/sykesm/loggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/sykesm/loggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/sykesm/loggregator/contents/{+path}","compare_url":"https://api.github.com/repos/sykesm/loggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sykesm/loggregator/merges","archive_url":"https://api.github.com/repos/sykesm/loggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sykesm/loggregator/downloads","issues_url":"https://api.github.com/repos/sykesm/loggregator/issues{/number}","pulls_url":"https://api.github.com/repos/sykesm/loggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/sykesm/loggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/sykesm/loggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sykesm/loggregator/labels{/name}","releases_url":"https://api.github.com/repos/sykesm/loggregator/releases{/id}","created_at":"2015-07-29T15:36:55Z","updated_at":"2015-07-29T15:36:55Z","pushed_at":"2015-08-18T20:23:15Z","git_url":"git://github.com/sykesm/loggregator.git","ssh_url":"git@github.com:sykesm/loggregator.git","clone_url":"https://github.com/sykesm/loggregator.git","svn_url":"https://github.com/sykesm/loggregator","homepage":null,"size":19802,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"develop"}},"base":{"label":"cloudfoundry:develop","ref":"develop","sha":"b23b8ad8bb72518cb62e96096e2a5a24a593377e","user":{"login":"cloudfoundry","id":621746,"avatar_url":"https://avatars.githubusercontent.com/u/621746?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudfoundry","html_url":"https://github.com/cloudfoundry","followers_url":"https://api.github.com/users/cloudfoundry/followers","following_url":"https://api.github.com/users/cloudfoundry/following{/other_user}","gists_url":"https://api.github.com/users/cloudfoundry/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudfoundry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudfoundry/subscriptions","organizations_url":"https://api.github.com/users/cloudfoundry/orgs","repos_url":"https://api.github.com/users/cloudfoundry/repos","events_url":"https://api.github.com/users/cloudfoundry/events{/privacy}","received_events_url":"https://api.github.com/users/cloudfoundry/received_events","type":"Organization","site_admin":false},"repo":{"id":10800667,"name":"loggregator","full_name":"cloudfoundry/loggregator","owner":{"login":"cloudfoundry","id":621746,"avatar_url":"https://avatars.githubusercontent.com/u/621746?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudfoundry","html_url":"https://github.com/cloudfoundry","followers_url":"https://api.github.com/users/cloudfoundry/followers","following_url":"https://api.github.com/users/cloudfoundry/following{/other_user}","gists_url":"https://api.github.com/users/cloudfoundry/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudfoundry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudfoundry/subscriptions","organizations_url":"https://api.github.com/users/cloudfoundry/orgs","repos_url":"https://api.github.com/users/cloudfoundry/repos","events_url":"https://api.github.com/users/cloudfoundry/events{/privacy}","received_events_url":"https://api.github.com/users/cloudfoundry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudfoundry/loggregator","description":"Logging in the Clouds","fork":false,"url":"https://api.github.com/repos/cloudfoundry/loggregator","forks_url":"https://api.github.com/repos/cloudfoundry/loggregator/forks","keys_url":"https://api.github.com/repos/cloudfoundry/loggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudfoundry/loggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudfoundry/loggregator/teams","hooks_url":"https://api.github.com/repos/cloudfoundry/loggregator/hooks","issue_events_url":"https://api.github.com/repos/cloudfoundry/loggregator/issues/events{/number}","events_url":"https://api.github.com/repos/cloudfoundry/loggregator/events","assignees_url":"https://api.github.com/repos/cloudfoundry/loggregator/assignees{/user}","branches_url":"https://api.github.com/repos/cloudfoundry/loggregator/branches{/branch}","tags_url":"https://api.github.com/repos/cloudfoundry/loggregator/tags","blobs_url":"https://api.github.com/repos/cloudfoundry/loggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudfoundry/loggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudfoundry/loggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudfoundry/loggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudfoundry/loggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudfoundry/loggregator/languages","stargazers_url":"https://api.github.com/repos/cloudfoundry/loggregator/stargazers","contributors_url":"https://api.github.com/repos/cloudfoundry/loggregator/contributors","subscribers_url":"https://api.github.com/repos/cloudfoundry/loggregator/subscribers","subscription_url":"https://api.github.com/repos/cloudfoundry/loggregator/subscription","commits_url":"https://api.github.com/repos/cloudfoundry/loggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudfoundry/loggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudfoundry/loggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudfoundry/loggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudfoundry/loggregator/contents/{+path}","compare_url":"https://api.github.com/repos/cloudfoundry/loggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudfoundry/loggregator/merges","archive_url":"https://api.github.com/repos/cloudfoundry/loggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudfoundry/loggregator/downloads","issues_url":"https://api.github.com/repos/cloudfoundry/loggregator/issues{/number}","pulls_url":"https://api.github.com/repos/cloudfoundry/loggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudfoundry/loggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudfoundry/loggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudfoundry/loggregator/labels{/name}","releases_url":"https://api.github.com/repos/cloudfoundry/loggregator/releases{/id}","created_at":"2013-06-19T17:14:38Z","updated_at":"2015-08-25T12:22:13Z","pushed_at":"2015-08-26T20:11:54Z","git_url":"git://github.com/cloudfoundry/loggregator.git","ssh_url":"git@github.com:cloudfoundry/loggregator.git","clone_url":"https://github.com/cloudfoundry/loggregator.git","svn_url":"https://github.com/cloudfoundry/loggregator","homepage":null,"size":25320,"stargazers_count":104,"watchers_count":104,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":8,"forks":66,"open_issues":8,"watchers":104,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70"},"html":{"href":"https://github.com/cloudfoundry/loggregator/pull/70"},"issue":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/issues/70"},"comments":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/cloudfoundry/loggregator/statuses/7b8457d02a56aca49ef19605381bc140e8988ca4"}}}}