{"action":"created","comment":{"url":"https://api.github.com/repos/eleme/thrift_connector/pulls/comments/24306869","id":24306869,"diff_hunk":"@@ -272,6 +279,15 @@ def connection_ctx(self):\n             self.put_back_connection(client)\n             raise\n \n+    @contextlib.contextmanager\n+    def make_temporary_client(self, host, port):\n+        client = self.produce_client(host, port)\n+        try:\n+            yield client\n+        except Exception:\n+            client.close()","path":"thrift_connector/connection_pool.py","position":28,"original_position":28,"commit_id":"09068de6a8e32262a544ad965a2b0990ba860966","original_commit_id":"09068de6a8e32262a544ad965a2b0990ba860966","user":{"login":"wooparadog","id":1130984,"avatar_url":"https://avatars.githubusercontent.com/u/1130984?v=3","gravatar_id":"","url":"https://api.github.com/users/wooparadog","html_url":"https://github.com/wooparadog","followers_url":"https://api.github.com/users/wooparadog/followers","following_url":"https://api.github.com/users/wooparadog/following{/other_user}","gists_url":"https://api.github.com/users/wooparadog/gists{/gist_id}","starred_url":"https://api.github.com/users/wooparadog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wooparadog/subscriptions","organizations_url":"https://api.github.com/users/wooparadog/orgs","repos_url":"https://api.github.com/users/wooparadog/repos","events_url":"https://api.github.com/users/wooparadog/events{/privacy}","received_events_url":"https://api.github.com/users/wooparadog/received_events","type":"User","site_admin":false},"body":"这个放到 finally 里面去","created_at":"2015-02-09T02:47:40Z","updated_at":"2015-02-09T02:47:40Z","html_url":"https://github.com/eleme/thrift_connector/pull/5#discussion_r24306869","pull_request_url":"https://api.github.com/repos/eleme/thrift_connector/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/eleme/thrift_connector/pulls/comments/24306869"},"html":{"href":"https://github.com/eleme/thrift_connector/pull/5#discussion_r24306869"},"pull_request":{"href":"https://api.github.com/repos/eleme/thrift_connector/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/eleme/thrift_connector/pulls/5","id":28540009,"html_url":"https://github.com/eleme/thrift_connector/pull/5","diff_url":"https://github.com/eleme/thrift_connector/pull/5.diff","patch_url":"https://github.com/eleme/thrift_connector/pull/5.patch","issue_url":"https://api.github.com/repos/eleme/thrift_connector/issues/5","number":5,"state":"open","locked":false,"title":"add temporary_client to connection pool","user":{"login":"wangxiangyu","id":3917969,"avatar_url":"https://avatars.githubusercontent.com/u/3917969?v=3","gravatar_id":"","url":"https://api.github.com/users/wangxiangyu","html_url":"https://github.com/wangxiangyu","followers_url":"https://api.github.com/users/wangxiangyu/followers","following_url":"https://api.github.com/users/wangxiangyu/following{/other_user}","gists_url":"https://api.github.com/users/wangxiangyu/gists{/gist_id}","starred_url":"https://api.github.com/users/wangxiangyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangxiangyu/subscriptions","organizations_url":"https://api.github.com/users/wangxiangyu/orgs","repos_url":"https://api.github.com/users/wangxiangyu/repos","events_url":"https://api.github.com/users/wangxiangyu/events{/privacy}","received_events_url":"https://api.github.com/users/wangxiangyu/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-03T10:10:25Z","updated_at":"2015-02-09T02:47:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"512055156248708da0ede7cf35356d5a83419c32","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eleme/thrift_connector/pulls/5/commits","review_comments_url":"https://api.github.com/repos/eleme/thrift_connector/pulls/5/comments","review_comment_url":"https://api.github.com/repos/eleme/thrift_connector/pulls/comments/{number}","comments_url":"https://api.github.com/repos/eleme/thrift_connector/issues/5/comments","statuses_url":"https://api.github.com/repos/eleme/thrift_connector/statuses/09068de6a8e32262a544ad965a2b0990ba860966","head":{"label":"wangxiangyu:master","ref":"master","sha":"09068de6a8e32262a544ad965a2b0990ba860966","user":{"login":"wangxiangyu","id":3917969,"avatar_url":"https://avatars.githubusercontent.com/u/3917969?v=3","gravatar_id":"","url":"https://api.github.com/users/wangxiangyu","html_url":"https://github.com/wangxiangyu","followers_url":"https://api.github.com/users/wangxiangyu/followers","following_url":"https://api.github.com/users/wangxiangyu/following{/other_user}","gists_url":"https://api.github.com/users/wangxiangyu/gists{/gist_id}","starred_url":"https://api.github.com/users/wangxiangyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangxiangyu/subscriptions","organizations_url":"https://api.github.com/users/wangxiangyu/orgs","repos_url":"https://api.github.com/users/wangxiangyu/repos","events_url":"https://api.github.com/users/wangxiangyu/events{/privacy}","received_events_url":"https://api.github.com/users/wangxiangyu/received_events","type":"User","site_admin":false},"repo":{"id":30167687,"name":"thrift_connector","full_name":"wangxiangyu/thrift_connector","owner":{"login":"wangxiangyu","id":3917969,"avatar_url":"https://avatars.githubusercontent.com/u/3917969?v=3","gravatar_id":"","url":"https://api.github.com/users/wangxiangyu","html_url":"https://github.com/wangxiangyu","followers_url":"https://api.github.com/users/wangxiangyu/followers","following_url":"https://api.github.com/users/wangxiangyu/following{/other_user}","gists_url":"https://api.github.com/users/wangxiangyu/gists{/gist_id}","starred_url":"https://api.github.com/users/wangxiangyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangxiangyu/subscriptions","organizations_url":"https://api.github.com/users/wangxiangyu/orgs","repos_url":"https://api.github.com/users/wangxiangyu/repos","events_url":"https://api.github.com/users/wangxiangyu/events{/privacy}","received_events_url":"https://api.github.com/users/wangxiangyu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wangxiangyu/thrift_connector","description":"Clients of thrift, utilizing connection pools","fork":true,"url":"https://api.github.com/repos/wangxiangyu/thrift_connector","forks_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/forks","keys_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/teams","hooks_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/hooks","issue_events_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/issues/events{/number}","events_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/events","assignees_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/assignees{/user}","branches_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/branches{/branch}","tags_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/tags","blobs_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/statuses/{sha}","languages_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/languages","stargazers_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/stargazers","contributors_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/contributors","subscribers_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/subscribers","subscription_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/subscription","commits_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/issues/comments/{number}","contents_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/contents/{+path}","compare_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/merges","archive_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/downloads","issues_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/issues{/number}","pulls_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/pulls{/number}","milestones_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/milestones{/number}","notifications_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/labels{/name}","releases_url":"https://api.github.com/repos/wangxiangyu/thrift_connector/releases{/id}","created_at":"2015-02-02T02:21:32Z","updated_at":"2015-02-04T08:10:41Z","pushed_at":"2015-02-04T08:10:40Z","git_url":"git://github.com/wangxiangyu/thrift_connector.git","ssh_url":"git@github.com:wangxiangyu/thrift_connector.git","clone_url":"https://github.com/wangxiangyu/thrift_connector.git","svn_url":"https://github.com/wangxiangyu/thrift_connector","homepage":null,"size":120,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"eleme:master","ref":"master","sha":"864c05492c38743b938e9ee62245d0f3ffc04361","user":{"login":"eleme","id":1201438,"avatar_url":"https://avatars.githubusercontent.com/u/1201438?v=3","gravatar_id":"","url":"https://api.github.com/users/eleme","html_url":"https://github.com/eleme","followers_url":"https://api.github.com/users/eleme/followers","following_url":"https://api.github.com/users/eleme/following{/other_user}","gists_url":"https://api.github.com/users/eleme/gists{/gist_id}","starred_url":"https://api.github.com/users/eleme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eleme/subscriptions","organizations_url":"https://api.github.com/users/eleme/orgs","repos_url":"https://api.github.com/users/eleme/repos","events_url":"https://api.github.com/users/eleme/events{/privacy}","received_events_url":"https://api.github.com/users/eleme/received_events","type":"Organization","site_admin":false},"repo":{"id":25019902,"name":"thrift_connector","full_name":"eleme/thrift_connector","owner":{"login":"eleme","id":1201438,"avatar_url":"https://avatars.githubusercontent.com/u/1201438?v=3","gravatar_id":"","url":"https://api.github.com/users/eleme","html_url":"https://github.com/eleme","followers_url":"https://api.github.com/users/eleme/followers","following_url":"https://api.github.com/users/eleme/following{/other_user}","gists_url":"https://api.github.com/users/eleme/gists{/gist_id}","starred_url":"https://api.github.com/users/eleme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eleme/subscriptions","organizations_url":"https://api.github.com/users/eleme/orgs","repos_url":"https://api.github.com/users/eleme/repos","events_url":"https://api.github.com/users/eleme/events{/privacy}","received_events_url":"https://api.github.com/users/eleme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eleme/thrift_connector","description":"Clients of thrift, utilizing connection pools","fork":false,"url":"https://api.github.com/repos/eleme/thrift_connector","forks_url":"https://api.github.com/repos/eleme/thrift_connector/forks","keys_url":"https://api.github.com/repos/eleme/thrift_connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eleme/thrift_connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eleme/thrift_connector/teams","hooks_url":"https://api.github.com/repos/eleme/thrift_connector/hooks","issue_events_url":"https://api.github.com/repos/eleme/thrift_connector/issues/events{/number}","events_url":"https://api.github.com/repos/eleme/thrift_connector/events","assignees_url":"https://api.github.com/repos/eleme/thrift_connector/assignees{/user}","branches_url":"https://api.github.com/repos/eleme/thrift_connector/branches{/branch}","tags_url":"https://api.github.com/repos/eleme/thrift_connector/tags","blobs_url":"https://api.github.com/repos/eleme/thrift_connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eleme/thrift_connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eleme/thrift_connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/eleme/thrift_connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eleme/thrift_connector/statuses/{sha}","languages_url":"https://api.github.com/repos/eleme/thrift_connector/languages","stargazers_url":"https://api.github.com/repos/eleme/thrift_connector/stargazers","contributors_url":"https://api.github.com/repos/eleme/thrift_connector/contributors","subscribers_url":"https://api.github.com/repos/eleme/thrift_connector/subscribers","subscription_url":"https://api.github.com/repos/eleme/thrift_connector/subscription","commits_url":"https://api.github.com/repos/eleme/thrift_connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/eleme/thrift_connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/eleme/thrift_connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/eleme/thrift_connector/issues/comments/{number}","contents_url":"https://api.github.com/repos/eleme/thrift_connector/contents/{+path}","compare_url":"https://api.github.com/repos/eleme/thrift_connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eleme/thrift_connector/merges","archive_url":"https://api.github.com/repos/eleme/thrift_connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eleme/thrift_connector/downloads","issues_url":"https://api.github.com/repos/eleme/thrift_connector/issues{/number}","pulls_url":"https://api.github.com/repos/eleme/thrift_connector/pulls{/number}","milestones_url":"https://api.github.com/repos/eleme/thrift_connector/milestones{/number}","notifications_url":"https://api.github.com/repos/eleme/thrift_connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eleme/thrift_connector/labels{/name}","releases_url":"https://api.github.com/repos/eleme/thrift_connector/releases{/id}","created_at":"2014-10-10T04:08:13Z","updated_at":"2015-01-29T03:58:41Z","pushed_at":"2015-01-29T03:58:41Z","git_url":"git://github.com/eleme/thrift_connector.git","ssh_url":"git@github.com:eleme/thrift_connector.git","clone_url":"https://github.com/eleme/thrift_connector.git","svn_url":"https://github.com/eleme/thrift_connector","homepage":null,"size":228,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eleme/thrift_connector/pulls/5"},"html":{"href":"https://github.com/eleme/thrift_connector/pull/5"},"issue":{"href":"https://api.github.com/repos/eleme/thrift_connector/issues/5"},"comments":{"href":"https://api.github.com/repos/eleme/thrift_connector/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/eleme/thrift_connector/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/eleme/thrift_connector/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/eleme/thrift_connector/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/eleme/thrift_connector/statuses/09068de6a8e32262a544ad965a2b0990ba860966"}}}}