{"action":"created","comment":{"url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/comments/48126774","id":48126774,"diff_hunk":"@@ -64,3 +64,12 @@ def setup\n       instrumentation_service: @service\n   end\n end\n+\n+# Provide information about socket creation\n+class SocketHelpers\n+  class << self\n+    def default_socket_opts\n+      { connect_timeout: Net::LDAP::Connection::DefaultConnectTimeout }\n+    end\n+  end\n+end","path":"test/test_helper.rb","position":null,"original_position":12,"commit_id":"960ad235aba33ad4d6758b5b9c5d585b091b3787","original_commit_id":"68bdf96e007ab844a112c2aaa4ffc8c3d375282b","user":{"login":"astratto","id":207754,"avatar_url":"https://avatars.githubusercontent.com/u/207754?v=3","gravatar_id":"","url":"https://api.github.com/users/astratto","html_url":"https://github.com/astratto","followers_url":"https://api.github.com/users/astratto/followers","following_url":"https://api.github.com/users/astratto/following{/other_user}","gists_url":"https://api.github.com/users/astratto/gists{/gist_id}","starred_url":"https://api.github.com/users/astratto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astratto/subscriptions","organizations_url":"https://api.github.com/users/astratto/orgs","repos_url":"https://api.github.com/users/astratto/repos","events_url":"https://api.github.com/users/astratto/events{/privacy}","received_events_url":"https://api.github.com/users/astratto/received_events","type":"User","site_admin":false},"body":"Yes, I see your point. Changed.","created_at":"2015-12-21T09:01:42Z","updated_at":"2015-12-21T09:01:42Z","html_url":"https://github.com/ruby-ldap/ruby-net-ldap/pull/243#discussion_r48126774","pull_request_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243","_links":{"self":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/comments/48126774"},"html":{"href":"https://github.com/ruby-ldap/ruby-net-ldap/pull/243#discussion_r48126774"},"pull_request":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243"}}},"pull_request":{"url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243","id":53964480,"html_url":"https://github.com/ruby-ldap/ruby-net-ldap/pull/243","diff_url":"https://github.com/ruby-ldap/ruby-net-ldap/pull/243.diff","patch_url":"https://github.com/ruby-ldap/ruby-net-ldap/pull/243.patch","issue_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues/243","number":243,"state":"open","locked":false,"title":"Set a connect_timeout for the creation of a socket","user":{"login":"astratto","id":207754,"avatar_url":"https://avatars.githubusercontent.com/u/207754?v=3","gravatar_id":"","url":"https://api.github.com/users/astratto","html_url":"https://github.com/astratto","followers_url":"https://api.github.com/users/astratto/followers","following_url":"https://api.github.com/users/astratto/following{/other_user}","gists_url":"https://api.github.com/users/astratto/gists{/gist_id}","starred_url":"https://api.github.com/users/astratto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astratto/subscriptions","organizations_url":"https://api.github.com/users/astratto/orgs","repos_url":"https://api.github.com/users/astratto/repos","events_url":"https://api.github.com/users/astratto/events{/privacy}","received_events_url":"https://api.github.com/users/astratto/received_events","type":"User","site_admin":false},"body":"Currently when an LDAP server is not reachable (for instance, packets are dropped), users of this library end up waiting for a quite long period of time. This is very rarely acceptable and can easily lead to a chain of failures with several services timing out before the socket creation actually fails.\r\n \r\nThis patch uses Socket.tcp instead of TCPSocket.new and provides a default connect_timeout of 1 second.\r\n\r\n_Notes:_\r\n- I couldn't find a way in the integration tests to write a proper test for this. As far as I can tell, there are no tests at that level to validate connection failures, etc... Am I right?\r\n- I set the timeout to 1 sec, but probably a better way could be setting it to a higher value and provide an easier way to customise it?\r\n","created_at":"2015-12-17T11:24:40Z","updated_at":"2015-12-21T09:01:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc1fa729cd2672d22bb0e9784c6eddf1096eca19","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243/commits","review_comments_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243/comments","review_comment_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues/243/comments","statuses_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/statuses/960ad235aba33ad4d6758b5b9c5d585b091b3787","head":{"label":"astratto:connect_timeout","ref":"connect_timeout","sha":"960ad235aba33ad4d6758b5b9c5d585b091b3787","user":{"login":"astratto","id":207754,"avatar_url":"https://avatars.githubusercontent.com/u/207754?v=3","gravatar_id":"","url":"https://api.github.com/users/astratto","html_url":"https://github.com/astratto","followers_url":"https://api.github.com/users/astratto/followers","following_url":"https://api.github.com/users/astratto/following{/other_user}","gists_url":"https://api.github.com/users/astratto/gists{/gist_id}","starred_url":"https://api.github.com/users/astratto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astratto/subscriptions","organizations_url":"https://api.github.com/users/astratto/orgs","repos_url":"https://api.github.com/users/astratto/repos","events_url":"https://api.github.com/users/astratto/events{/privacy}","received_events_url":"https://api.github.com/users/astratto/received_events","type":"User","site_admin":false},"repo":{"id":48169490,"name":"ruby-net-ldap","full_name":"astratto/ruby-net-ldap","owner":{"login":"astratto","id":207754,"avatar_url":"https://avatars.githubusercontent.com/u/207754?v=3","gravatar_id":"","url":"https://api.github.com/users/astratto","html_url":"https://github.com/astratto","followers_url":"https://api.github.com/users/astratto/followers","following_url":"https://api.github.com/users/astratto/following{/other_user}","gists_url":"https://api.github.com/users/astratto/gists{/gist_id}","starred_url":"https://api.github.com/users/astratto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astratto/subscriptions","organizations_url":"https://api.github.com/users/astratto/orgs","repos_url":"https://api.github.com/users/astratto/repos","events_url":"https://api.github.com/users/astratto/events{/privacy}","received_events_url":"https://api.github.com/users/astratto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/astratto/ruby-net-ldap","description":"Pure Ruby LDAP library ","fork":true,"url":"https://api.github.com/repos/astratto/ruby-net-ldap","forks_url":"https://api.github.com/repos/astratto/ruby-net-ldap/forks","keys_url":"https://api.github.com/repos/astratto/ruby-net-ldap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astratto/ruby-net-ldap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astratto/ruby-net-ldap/teams","hooks_url":"https://api.github.com/repos/astratto/ruby-net-ldap/hooks","issue_events_url":"https://api.github.com/repos/astratto/ruby-net-ldap/issues/events{/number}","events_url":"https://api.github.com/repos/astratto/ruby-net-ldap/events","assignees_url":"https://api.github.com/repos/astratto/ruby-net-ldap/assignees{/user}","branches_url":"https://api.github.com/repos/astratto/ruby-net-ldap/branches{/branch}","tags_url":"https://api.github.com/repos/astratto/ruby-net-ldap/tags","blobs_url":"https://api.github.com/repos/astratto/ruby-net-ldap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astratto/ruby-net-ldap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astratto/ruby-net-ldap/git/refs{/sha}","trees_url":"https://api.github.com/repos/astratto/ruby-net-ldap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astratto/ruby-net-ldap/statuses/{sha}","languages_url":"https://api.github.com/repos/astratto/ruby-net-ldap/languages","stargazers_url":"https://api.github.com/repos/astratto/ruby-net-ldap/stargazers","contributors_url":"https://api.github.com/repos/astratto/ruby-net-ldap/contributors","subscribers_url":"https://api.github.com/repos/astratto/ruby-net-ldap/subscribers","subscription_url":"https://api.github.com/repos/astratto/ruby-net-ldap/subscription","commits_url":"https://api.github.com/repos/astratto/ruby-net-ldap/commits{/sha}","git_commits_url":"https://api.github.com/repos/astratto/ruby-net-ldap/git/commits{/sha}","comments_url":"https://api.github.com/repos/astratto/ruby-net-ldap/comments{/number}","issue_comment_url":"https://api.github.com/repos/astratto/ruby-net-ldap/issues/comments{/number}","contents_url":"https://api.github.com/repos/astratto/ruby-net-ldap/contents/{+path}","compare_url":"https://api.github.com/repos/astratto/ruby-net-ldap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astratto/ruby-net-ldap/merges","archive_url":"https://api.github.com/repos/astratto/ruby-net-ldap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astratto/ruby-net-ldap/downloads","issues_url":"https://api.github.com/repos/astratto/ruby-net-ldap/issues{/number}","pulls_url":"https://api.github.com/repos/astratto/ruby-net-ldap/pulls{/number}","milestones_url":"https://api.github.com/repos/astratto/ruby-net-ldap/milestones{/number}","notifications_url":"https://api.github.com/repos/astratto/ruby-net-ldap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astratto/ruby-net-ldap/labels{/name}","releases_url":"https://api.github.com/repos/astratto/ruby-net-ldap/releases{/id}","created_at":"2015-12-17T10:59:56Z","updated_at":"2015-12-17T10:59:56Z","pushed_at":"2015-12-21T09:00:40Z","git_url":"git://github.com/astratto/ruby-net-ldap.git","ssh_url":"git@github.com:astratto/ruby-net-ldap.git","clone_url":"https://github.com/astratto/ruby-net-ldap.git","svn_url":"https://github.com/astratto/ruby-net-ldap","homepage":"https://github.com/ruby-ldap/ruby-net-ldap","size":1052,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"ruby-ldap:master","ref":"master","sha":"ea21ef9478b4af785808deab8a40b89936618ef2","user":{"login":"ruby-ldap","id":676122,"avatar_url":"https://avatars.githubusercontent.com/u/676122?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-ldap","html_url":"https://github.com/ruby-ldap","followers_url":"https://api.github.com/users/ruby-ldap/followers","following_url":"https://api.github.com/users/ruby-ldap/following{/other_user}","gists_url":"https://api.github.com/users/ruby-ldap/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-ldap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-ldap/subscriptions","organizations_url":"https://api.github.com/users/ruby-ldap/orgs","repos_url":"https://api.github.com/users/ruby-ldap/repos","events_url":"https://api.github.com/users/ruby-ldap/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-ldap/received_events","type":"Organization","site_admin":false},"repo":{"id":1509861,"name":"ruby-net-ldap","full_name":"ruby-ldap/ruby-net-ldap","owner":{"login":"ruby-ldap","id":676122,"avatar_url":"https://avatars.githubusercontent.com/u/676122?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-ldap","html_url":"https://github.com/ruby-ldap","followers_url":"https://api.github.com/users/ruby-ldap/followers","following_url":"https://api.github.com/users/ruby-ldap/following{/other_user}","gists_url":"https://api.github.com/users/ruby-ldap/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-ldap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-ldap/subscriptions","organizations_url":"https://api.github.com/users/ruby-ldap/orgs","repos_url":"https://api.github.com/users/ruby-ldap/repos","events_url":"https://api.github.com/users/ruby-ldap/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-ldap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-ldap/ruby-net-ldap","description":"Pure Ruby LDAP library ","fork":false,"url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap","forks_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/forks","keys_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/teams","hooks_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/hooks","issue_events_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/events","assignees_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/tags","blobs_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/languages","stargazers_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/stargazers","contributors_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/contributors","subscribers_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/subscribers","subscription_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/subscription","commits_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/merges","archive_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/downloads","issues_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/labels{/name}","releases_url":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/releases{/id}","created_at":"2011-03-22T03:52:14Z","updated_at":"2015-12-14T10:42:29Z","pushed_at":"2015-12-21T09:00:41Z","git_url":"git://github.com/ruby-ldap/ruby-net-ldap.git","ssh_url":"git@github.com:ruby-ldap/ruby-net-ldap.git","clone_url":"https://github.com/ruby-ldap/ruby-net-ldap.git","svn_url":"https://github.com/ruby-ldap/ruby-net-ldap","homepage":"https://github.com/ruby-ldap/ruby-net-ldap","size":1346,"stargazers_count":247,"watchers_count":247,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":170,"mirror_url":null,"open_issues_count":38,"forks":170,"open_issues":38,"watchers":247,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243"},"html":{"href":"https://github.com/ruby-ldap/ruby-net-ldap/pull/243"},"issue":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues/243"},"comments":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/issues/243/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/pulls/243/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-ldap/ruby-net-ldap/statuses/960ad235aba33ad4d6758b5b9c5d585b091b3787"}}}}