{"action":"created","issue":{"url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133","labels_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133/labels{/name}","comments_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133/comments","events_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133/events","html_url":"https://github.com/rubygems/rubygems.org/pull/1133","id":119566060,"number":1133,"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},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-30T19:47:42Z","updated_at":"2015-11-30T22:42:58Z","closed_at":"2015-11-30T21:13:37Z","pull_request":{"url":"https://api.github.com/repos/rubygems/rubygems.org/pulls/1133","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"},"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 "},"comment":{"url":"https://api.github.com/repos/rubygems/rubygems.org/issues/comments/160785261","html_url":"https://github.com/rubygems/rubygems.org/pull/1133#issuecomment-160785261","issue_url":"https://api.github.com/repos/rubygems/rubygems.org/issues/1133","id":160785261,"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},"created_at":"2015-11-30T22:42:58Z","updated_at":"2015-11-30T22:42:58Z","body":":tada: Great work! "}}