{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/frontend/pulls/comments/70594817","id":70594817,"diff_hunk":"@@ -32,11 +32,15 @@ class ArticleController extends Controller with RendersItemResponse with Logging\n \n   private def isSupported(c: ApiContent) = c.isArticle || c.isLiveBlog || c.isSudoku\n   override def canRender(i: ItemResponse): Boolean = i.content.exists(isSupported)\n-  override def renderItem(path: String)(implicit request: RequestHeader): Future[Result] = mapModel(path, blocks = true)(render(path, _))\n+  override def renderItem(path: String)(implicit request: RequestHeader): Future[Result] = mapModel(path, Some(Canonical))(render(path, _))\n \n \n-  private def renderNewerUpdates(page: PageWithStoryPackage, lastUpdateBlockId: String, isLivePage: Option[Boolean])(implicit request: RequestHeader): Result = {\n-    val newBlocks = page.article.fields.blocks.takeWhile(block => s\"block-${block.id}\" != lastUpdateBlockId)\n+  private def renderNewerUpdates(page: PageWithStoryPackage, lastUpdateBlockId: SinceBlockId, isLivePage: Option[Boolean])(implicit request: RequestHeader): Result = {\n+    val newBlocks = page.article.fields.blocks.toSeq.flatMap {\n+      _.requestedBodyBlocks.getOrElse(lastUpdateBlockId.around, Seq())\n+    }.takeWhile { block =>\n+      block.id != lastUpdateBlockId.lastUpdate\n+    }","path":"article/app/controllers/ArticleController.scala","position":31,"original_position":31,"commit_id":"38a2b70fb71f28e311d4a48f3871893b25c5a327","original_commit_id":"38a2b70fb71f28e311d4a48f3871893b25c5a327","user":{"login":"johnduffell","id":7304387,"avatar_url":"https://avatars.githubusercontent.com/u/7304387?v=3","gravatar_id":"","url":"https://api.github.com/users/johnduffell","html_url":"https://github.com/johnduffell","followers_url":"https://api.github.com/users/johnduffell/followers","following_url":"https://api.github.com/users/johnduffell/following{/other_user}","gists_url":"https://api.github.com/users/johnduffell/gists{/gist_id}","starred_url":"https://api.github.com/users/johnduffell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnduffell/subscriptions","organizations_url":"https://api.github.com/users/johnduffell/orgs","repos_url":"https://api.github.com/users/johnduffell/repos","events_url":"https://api.github.com/users/johnduffell/events{/privacy}","received_events_url":"https://api.github.com/users/johnduffell/received_events","type":"User","site_admin":false},"body":"yes","created_at":"2016-07-13T09:44:25Z","updated_at":"2016-07-13T09:44:25Z","html_url":"https://github.com/guardian/frontend/pull/13566#discussion_r70594817","pull_request_url":"https://api.github.com/repos/guardian/frontend/pulls/13566","_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments/70594817"},"html":{"href":"https://github.com/guardian/frontend/pull/13566#discussion_r70594817"},"pull_request":{"href":"https://api.github.com/repos/guardian/frontend/pulls/13566"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/frontend/pulls/13566","id":77103093,"html_url":"https://github.com/guardian/frontend/pull/13566","diff_url":"https://github.com/guardian/frontend/pull/13566.diff","patch_url":"https://github.com/guardian/frontend/pull/13566.patch","issue_url":"https://api.github.com/repos/guardian/frontend/issues/13566","number":13566,"state":"open","locked":false,"title":"Don't request all the blocks for liveblog main page","user":{"login":"johnduffell","id":7304387,"avatar_url":"https://avatars.githubusercontent.com/u/7304387?v=3","gravatar_id":"","url":"https://api.github.com/users/johnduffell","html_url":"https://github.com/johnduffell","followers_url":"https://api.github.com/users/johnduffell/followers","following_url":"https://api.github.com/users/johnduffell/following{/other_user}","gists_url":"https://api.github.com/users/johnduffell/gists{/gist_id}","starred_url":"https://api.github.com/users/johnduffell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnduffell/subscriptions","organizations_url":"https://api.github.com/users/johnduffell/orgs","repos_url":"https://api.github.com/users/johnduffell/repos","events_url":"https://api.github.com/users/johnduffell/events{/privacy}","received_events_url":"https://api.github.com/users/johnduffell/received_events","type":"User","site_admin":false},"body":"This PR changes the CAPI query for liveblog page 1 (the live page) and the ajax \"get updates\" call to only retrieve the necessary blocks, rather than the whole liveblog.\r\n\r\nThis should save a lot of bandwidth as liveblogs get bigger, and also reduce the CPU usage both in CAPI and frontend.  We noticed things were particularly bad when there were many big liveblogs running after brexit.  This is a problem particularly for those two endpoints because they only have a 5 second cache time.  Archive pages of a live blog cache for a few minutes.\r\n\r\nThis is part 2 of the series - part 1 was https://github.com/guardian/frontend/pull/13458\r\n\r\n@TBonnin @cb372 @JustinPinner any comments or +1s please!","created_at":"2016-07-12T11:24:26Z","updated_at":"2016-07-13T09:44:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79efdcd8d5be1fe95e0fbf2c4be7c63ce881135f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/frontend/pulls/13566/commits","review_comments_url":"https://api.github.com/repos/guardian/frontend/pulls/13566/comments","review_comment_url":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/frontend/issues/13566/comments","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/38a2b70fb71f28e311d4a48f3871893b25c5a327","head":{"label":"guardian:liveblog-blocks","ref":"liveblog-blocks","sha":"38a2b70fb71f28e311d4a48f3871893b25c5a327","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2016-07-12T22:00:51Z","pushed_at":"2016-07-13T09:40:31Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":495228,"stargazers_count":3239,"watchers_count":3239,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":333,"mirror_url":null,"open_issues_count":57,"forks":333,"open_issues":57,"watchers":3239,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"491f171bc0d9009a88db73babfe5d7cf17daca25","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars.githubusercontent.com/u/164318?v=3","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2016-07-12T22:00:51Z","pushed_at":"2016-07-13T09:40:31Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"http://www.theguardian.com","size":495228,"stargazers_count":3239,"watchers_count":3239,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":333,"mirror_url":null,"open_issues_count":57,"forks":333,"open_issues":57,"watchers":3239,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/13566"},"html":{"href":"https://github.com/guardian/frontend/pull/13566"},"issue":{"href":"https://api.github.com/repos/guardian/frontend/issues/13566"},"comments":{"href":"https://api.github.com/repos/guardian/frontend/issues/13566/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/frontend/pulls/13566/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/frontend/pulls/13566/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/frontend/statuses/38a2b70fb71f28e311d4a48f3871893b25c5a327"}}}}
{"actor":{"display_login":"johnduffell"}}