{"action":"created","comment":{"url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/comments/46197726","id":46197726,"diff_hunk":"@@ -12,7 +12,7 @@ Metrics/AbcSize:\n   Max: 42 # TODO: Lower to 15\n \n Metrics/ClassLength:\n-  Max: 300 # TODO: Lower to 100\n+  Max: 350 # TODO: Lower to 100","path":".rubocop.yml","position":5,"original_position":5,"commit_id":"4d8a52314bb33c435698016b9e6e410a330af19f","original_commit_id":"4d8a52314bb33c435698016b9e6e410a330af19f","user":{"login":"nateberkopec","id":845662,"avatar_url":"https://avatars.githubusercontent.com/u/845662?v=3","gravatar_id":"","url":"https://api.github.com/users/nateberkopec","html_url":"https://github.com/nateberkopec","followers_url":"https://api.github.com/users/nateberkopec/followers","following_url":"https://api.github.com/users/nateberkopec/following{/other_user}","gists_url":"https://api.github.com/users/nateberkopec/gists{/gist_id}","starred_url":"https://api.github.com/users/nateberkopec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nateberkopec/subscriptions","organizations_url":"https://api.github.com/users/nateberkopec/orgs","repos_url":"https://api.github.com/users/nateberkopec/repos","events_url":"https://api.github.com/users/nateberkopec/events{/privacy}","received_events_url":"https://api.github.com/users/nateberkopec/received_events","type":"User","site_admin":false},"body":":laughing: ","created_at":"2015-11-30T20:21:56Z","updated_at":"2015-11-30T20:21:56Z","html_url":"https://github.com/rubygems/rubygems.org/pull/1133#discussion_r46197726","pull_request_url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133","_links":{"self":{"href":"https://api.github.com/repos/rubygems/rubygems.org/pulls/comments/46197726"},"html":{"href":"https://github.com/rubygems/rubygems.org/pull/1133#discussion_r46197726"},"pull_request":{"href":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133"}}},"pull_request":{"url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133","id":52169851,"html_url":"https://github.com/rubygems/rubygems.org/pull/1133","diff_url":"https://github.com/rubygems/rubygems.org/pull/1133.diff","patch_url":"https://github.com/rubygems/rubygems.org/pull/1133.patch","issue_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133","number":1133,"state":"open","locked":false,"title":"N+1 on activities api","user":{"login":"arthurnn","id":833383,"avatar_url":"https://avatars.githubusercontent.com/u/833383?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurnn","html_url":"https://github.com/arthurnn","followers_url":"https://api.github.com/users/arthurnn/followers","following_url":"https://api.github.com/users/arthurnn/following{/other_user}","gists_url":"https://api.github.com/users/arthurnn/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurnn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurnn/subscriptions","organizations_url":"https://api.github.com/users/arthurnn/orgs","repos_url":"https://api.github.com/users/arthurnn/repos","events_url":"https://api.github.com/users/arthurnn/events{/privacy}","received_events_url":"https://api.github.com/users/arthurnn/received_events","type":"User","site_admin":true},"body":"`latest` and `just_updated` endpoints need to load information from a few\r\nother tables, which was causing some big N+1 queries on those endpoints.\r\n\r\nAlso, improve the query for `latest`, as that didnt have a limit on the\r\ninner query, and eliminate the `latest` flag check, as we already check\r\nif thats the only version for that rubygem.\r\n\r\nbefore:\r\n```\r\nStarted GET \"/api/v1/activity/latest.json\" for ::1 at 2015-11-30 14:45:23 -0500\r\nCompleted 200 OK in 4233ms (Views: 810.5ms | ActiveRecord: 3416.9ms | Elasticsearch: 0.0ms)\r\n```\r\n\r\nafter:\r\n```\r\nStarted GET \"/api/v1/activity/latest.json\" for ::1 at 2015-11-30 14:44:15 -0500\r\nCompleted 200 OK in 283ms (Views: 19.0ms | ActiveRecord: 15.8ms | Elasticsearch: 0.0ms)\r\n```\r\n\r\nreview @dwradcliffe ","created_at":"2015-11-30T19:47:42Z","updated_at":"2015-11-30T20:21:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7525266b90a43a1b09ad5c6e631dbf5779ef636a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133/commits","review_comments_url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133/comments","review_comment_url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133/comments","statuses_url":"https://api.github.com/repos/rubygems/rubygems.org/statuses/4d8a52314bb33c435698016b9e6e410a330af19f","head":{"label":"rubygems:arthurnn/nplusone_activities","ref":"arthurnn/nplusone_activities","sha":"4d8a52314bb33c435698016b9e6e410a330af19f","user":{"login":"rubygems","id":208761,"avatar_url":"https://avatars.githubusercontent.com/u/208761?v=3","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"repo":{"id":117646,"name":"rubygems.org","full_name":"rubygems/rubygems.org","owner":{"login":"rubygems","id":208761,"avatar_url":"https://avatars.githubusercontent.com/u/208761?v=3","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubygems/rubygems.org","description":"The Ruby community's gem hosting service.","fork":false,"url":"https://api.github.com/repos/rubygems/rubygems.org","forks_url":"https://api.github.com/repos/rubygems/rubygems.org/forks","keys_url":"https://api.github.com/repos/rubygems/rubygems.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubygems/rubygems.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubygems/rubygems.org/teams","hooks_url":"https://api.github.com/repos/rubygems/rubygems.org/hooks","issue_events_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/events{/number}","events_url":"https://api.github.com/repos/rubygems/rubygems.org/events","assignees_url":"https://api.github.com/repos/rubygems/rubygems.org/assignees{/user}","branches_url":"https://api.github.com/repos/rubygems/rubygems.org/branches{/branch}","tags_url":"https://api.github.com/repos/rubygems/rubygems.org/tags","blobs_url":"https://api.github.com/repos/rubygems/rubygems.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubygems/rubygems.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubygems/rubygems.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubygems/rubygems.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubygems/rubygems.org/statuses/{sha}","languages_url":"https://api.github.com/repos/rubygems/rubygems.org/languages","stargazers_url":"https://api.github.com/repos/rubygems/rubygems.org/stargazers","contributors_url":"https://api.github.com/repos/rubygems/rubygems.org/contributors","subscribers_url":"https://api.github.com/repos/rubygems/rubygems.org/subscribers","subscription_url":"https://api.github.com/repos/rubygems/rubygems.org/subscription","commits_url":"https://api.github.com/repos/rubygems/rubygems.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubygems/rubygems.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubygems/rubygems.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubygems/rubygems.org/contents/{+path}","compare_url":"https://api.github.com/repos/rubygems/rubygems.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubygems/rubygems.org/merges","archive_url":"https://api.github.com/repos/rubygems/rubygems.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubygems/rubygems.org/downloads","issues_url":"https://api.github.com/repos/rubygems/rubygems.org/issues{/number}","pulls_url":"https://api.github.com/repos/rubygems/rubygems.org/pulls{/number}","milestones_url":"https://api.github.com/repos/rubygems/rubygems.org/milestones{/number}","notifications_url":"https://api.github.com/repos/rubygems/rubygems.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubygems/rubygems.org/labels{/name}","releases_url":"https://api.github.com/repos/rubygems/rubygems.org/releases{/id}","created_at":"2009-01-29T22:30:46Z","updated_at":"2015-11-30T06:45:14Z","pushed_at":"2015-11-30T19:57:07Z","git_url":"git://github.com/rubygems/rubygems.org.git","ssh_url":"git@github.com:rubygems/rubygems.org.git","clone_url":"https://github.com/rubygems/rubygems.org.git","svn_url":"https://github.com/rubygems/rubygems.org","homepage":"https://rubygems.org","size":634917,"stargazers_count":1271,"watchers_count":1271,"language":"HTML","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":503,"mirror_url":null,"open_issues_count":38,"forks":503,"open_issues":38,"watchers":1271,"default_branch":"master"}},"base":{"label":"rubygems:master","ref":"master","sha":"3e37f0e1b42b6f6453639ae74792a9a2a8751d3d","user":{"login":"rubygems","id":208761,"avatar_url":"https://avatars.githubusercontent.com/u/208761?v=3","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"repo":{"id":117646,"name":"rubygems.org","full_name":"rubygems/rubygems.org","owner":{"login":"rubygems","id":208761,"avatar_url":"https://avatars.githubusercontent.com/u/208761?v=3","gravatar_id":"","url":"https://api.github.com/users/rubygems","html_url":"https://github.com/rubygems","followers_url":"https://api.github.com/users/rubygems/followers","following_url":"https://api.github.com/users/rubygems/following{/other_user}","gists_url":"https://api.github.com/users/rubygems/gists{/gist_id}","starred_url":"https://api.github.com/users/rubygems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubygems/subscriptions","organizations_url":"https://api.github.com/users/rubygems/orgs","repos_url":"https://api.github.com/users/rubygems/repos","events_url":"https://api.github.com/users/rubygems/events{/privacy}","received_events_url":"https://api.github.com/users/rubygems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rubygems/rubygems.org","description":"The Ruby community's gem hosting service.","fork":false,"url":"https://api.github.com/repos/rubygems/rubygems.org","forks_url":"https://api.github.com/repos/rubygems/rubygems.org/forks","keys_url":"https://api.github.com/repos/rubygems/rubygems.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rubygems/rubygems.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rubygems/rubygems.org/teams","hooks_url":"https://api.github.com/repos/rubygems/rubygems.org/hooks","issue_events_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/events{/number}","events_url":"https://api.github.com/repos/rubygems/rubygems.org/events","assignees_url":"https://api.github.com/repos/rubygems/rubygems.org/assignees{/user}","branches_url":"https://api.github.com/repos/rubygems/rubygems.org/branches{/branch}","tags_url":"https://api.github.com/repos/rubygems/rubygems.org/tags","blobs_url":"https://api.github.com/repos/rubygems/rubygems.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rubygems/rubygems.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rubygems/rubygems.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/rubygems/rubygems.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rubygems/rubygems.org/statuses/{sha}","languages_url":"https://api.github.com/repos/rubygems/rubygems.org/languages","stargazers_url":"https://api.github.com/repos/rubygems/rubygems.org/stargazers","contributors_url":"https://api.github.com/repos/rubygems/rubygems.org/contributors","subscribers_url":"https://api.github.com/repos/rubygems/rubygems.org/subscribers","subscription_url":"https://api.github.com/repos/rubygems/rubygems.org/subscription","commits_url":"https://api.github.com/repos/rubygems/rubygems.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/rubygems/rubygems.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/rubygems/rubygems.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/rubygems/rubygems.org/contents/{+path}","compare_url":"https://api.github.com/repos/rubygems/rubygems.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rubygems/rubygems.org/merges","archive_url":"https://api.github.com/repos/rubygems/rubygems.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rubygems/rubygems.org/downloads","issues_url":"https://api.github.com/repos/rubygems/rubygems.org/issues{/number}","pulls_url":"https://api.github.com/repos/rubygems/rubygems.org/pulls{/number}","milestones_url":"https://api.github.com/repos/rubygems/rubygems.org/milestones{/number}","notifications_url":"https://api.github.com/repos/rubygems/rubygems.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rubygems/rubygems.org/labels{/name}","releases_url":"https://api.github.com/repos/rubygems/rubygems.org/releases{/id}","created_at":"2009-01-29T22:30:46Z","updated_at":"2015-11-30T06:45:14Z","pushed_at":"2015-11-30T19:57:07Z","git_url":"git://github.com/rubygems/rubygems.org.git","ssh_url":"git@github.com:rubygems/rubygems.org.git","clone_url":"https://github.com/rubygems/rubygems.org.git","svn_url":"https://github.com/rubygems/rubygems.org","homepage":"https://rubygems.org","size":634917,"stargazers_count":1271,"watchers_count":1271,"language":"HTML","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":503,"mirror_url":null,"open_issues_count":38,"forks":503,"open_issues":38,"watchers":1271,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133"},"html":{"href":"https://github.com/rubygems/rubygems.org/pull/1133"},"issue":{"href":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133"},"comments":{"href":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133/comments"},"review_comments":{"href":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133/comments"},"review_comment":{"href":"https://api.github.com/repos/rubygems/rubygems.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133/commits"},"statuses":{"href":"https://api.github.com/repos/rubygems/rubygems.org/statuses/4d8a52314bb33c435698016b9e6e410a330af19f"}}}}