{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/525","labels_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/525/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/525/comments","events_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/525/events","html_url":"https://github.com/alphagov/specialist-publisher/pull/525","id":97064682,"number":525,"title":"Speed up publishing","user":{"login":"elliotcm","id":109225,"avatar_url":"https://avatars.githubusercontent.com/u/109225?v=3","gravatar_id":"","url":"https://api.github.com/users/elliotcm","html_url":"https://github.com/elliotcm","followers_url":"https://api.github.com/users/elliotcm/followers","following_url":"https://api.github.com/users/elliotcm/following{/other_user}","gists_url":"https://api.github.com/users/elliotcm/gists{/gist_id}","starred_url":"https://api.github.com/users/elliotcm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliotcm/subscriptions","organizations_url":"https://api.github.com/users/elliotcm/orgs","repos_url":"https://api.github.com/users/elliotcm/repos","events_url":"https://api.github.com/users/elliotcm/events{/privacy}","received_events_url":"https://api.github.com/users/elliotcm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-24T14:25:00Z","updated_at":"2015-07-27T09:40:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphagov/specialist-publisher/pulls/525","html_url":"https://github.com/alphagov/specialist-publisher/pull/525","diff_url":"https://github.com/alphagov/specialist-publisher/pull/525.diff","patch_url":"https://github.com/alphagov/specialist-publisher/pull/525.patch"},"body":"The intent of this PR is to get a big enough speed boost during the normal publishing flow to allow us to send to the draft publishing API and other services on every save instead of only on publish, and therefore allow easy previewing.\r\n\r\n### Changes\r\n#### Only call the organisation API once when publishing.\r\n\r\nWe currently call the organisation API for the\r\nmanual and each section, but the organisation slug\r\nused is the one from the manual, thus the response\r\nis guaranteed to always be the same.\r\n\r\n#### Avoid sending unchanged manual sections to publishing API.\r\n\r\nThis avoids a bunch of govspeak rendering and time\r\nwaiting on the API to respond.\r\n\r\n### Speed gains\r\n\r\nThe current time taken to publish a manual is around 1.5s per section, give or take.  This leads to documents like the open document format manual taking 32 seconds to publish (measured on the preview environment).\r\n\r\nAfter this change (and after the first time each document is published) the time taken to publish any document is around 3 seconds plus 1 second per changed section.\r\n\r\nhttps://trello.com/c/yP4BSFf3/284-speed-up-publishing-of-manuals"},"comment":{"url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/comments/125147271","html_url":"https://github.com/alphagov/specialist-publisher/pull/525#issuecomment-125147271","issue_url":"https://api.github.com/repos/alphagov/specialist-publisher/issues/525","id":125147271,"user":{"login":"danielroseman","id":131395,"avatar_url":"https://avatars.githubusercontent.com/u/131395?v=3","gravatar_id":"","url":"https://api.github.com/users/danielroseman","html_url":"https://github.com/danielroseman","followers_url":"https://api.github.com/users/danielroseman/followers","following_url":"https://api.github.com/users/danielroseman/following{/other_user}","gists_url":"https://api.github.com/users/danielroseman/gists{/gist_id}","starred_url":"https://api.github.com/users/danielroseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielroseman/subscriptions","organizations_url":"https://api.github.com/users/danielroseman/orgs","repos_url":"https://api.github.com/users/danielroseman/repos","events_url":"https://api.github.com/users/danielroseman/events{/privacy}","received_events_url":"https://api.github.com/users/danielroseman/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T09:40:23Z","updated_at":"2015-07-27T09:40:23Z","body":"Looks good. I think we need a migration to set the `exported_at` date on all published manuals, so that the first update doesn't incur the cost of exporting everything."}}