{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/paas-billing/issues/14","repository_url":"https://api.github.com/repos/alphagov/paas-billing","labels_url":"https://api.github.com/repos/alphagov/paas-billing/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/paas-billing/issues/14/comments","events_url":"https://api.github.com/repos/alphagov/paas-billing/issues/14/events","html_url":"https://github.com/alphagov/paas-billing/pull/14","id":298645187,"number":14,"title":"[#154395415] Refresh concurrently, refresh only on schedule","user":{"login":"camelpunch","id":141733,"avatar_url":"https://avatars3.githubusercontent.com/u/141733?v=4","gravatar_id":"","url":"https://api.github.com/users/camelpunch","html_url":"https://github.com/camelpunch","followers_url":"https://api.github.com/users/camelpunch/followers","following_url":"https://api.github.com/users/camelpunch/following{/other_user}","gists_url":"https://api.github.com/users/camelpunch/gists{/gist_id}","starred_url":"https://api.github.com/users/camelpunch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camelpunch/subscriptions","organizations_url":"https://api.github.com/users/camelpunch/orgs","repos_url":"https://api.github.com/users/camelpunch/repos","events_url":"https://api.github.com/users/camelpunch/events{/privacy}","received_events_url":"https://api.github.com/users/camelpunch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"henrytk","id":8709339,"avatar_url":"https://avatars2.githubusercontent.com/u/8709339?v=4","gravatar_id":"","url":"https://api.github.com/users/henrytk","html_url":"https://github.com/henrytk","followers_url":"https://api.github.com/users/henrytk/followers","following_url":"https://api.github.com/users/henrytk/following{/other_user}","gists_url":"https://api.github.com/users/henrytk/gists{/gist_id}","starred_url":"https://api.github.com/users/henrytk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrytk/subscriptions","organizations_url":"https://api.github.com/users/henrytk/orgs","repos_url":"https://api.github.com/users/henrytk/repos","events_url":"https://api.github.com/users/henrytk/events{/privacy}","received_events_url":"https://api.github.com/users/henrytk/received_events","type":"User","site_admin":false},"assignees":[{"login":"henrytk","id":8709339,"avatar_url":"https://avatars2.githubusercontent.com/u/8709339?v=4","gravatar_id":"","url":"https://api.github.com/users/henrytk","html_url":"https://github.com/henrytk","followers_url":"https://api.github.com/users/henrytk/followers","following_url":"https://api.github.com/users/henrytk/following{/other_user}","gists_url":"https://api.github.com/users/henrytk/gists{/gist_id}","starred_url":"https://api.github.com/users/henrytk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrytk/subscriptions","organizations_url":"https://api.github.com/users/henrytk/orgs","repos_url":"https://api.github.com/users/henrytk/repos","events_url":"https://api.github.com/users/henrytk/events{/privacy}","received_events_url":"https://api.github.com/users/henrytk/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-02-20T15:50:56Z","updated_at":"2018-02-22T11:16:40Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/alphagov/paas-billing/pulls/14","html_url":"https://github.com/alphagov/paas-billing/pull/14","diff_url":"https://github.com/alphagov/paas-billing/pull/14.diff","patch_url":"https://github.com/alphagov/paas-billing/pull/14.patch"},"body":"## What\r\n\r\nAllow the temporary view of the billing data to be refreshed concurrently with other operations. Remove code that triggered the view to be refreshed on pricing plan changes.\r\n\r\nIn order to add the concurrent behaviour, we [had to](https://www.postgresql.org/docs/9.6/static/sql-refreshmaterializedview.html) add a unique index to the view.\r\n\r\n## How to review\r\n\r\nRun the app, preferably with some production-like data in the local database. Ensure that the new schema is applied successfully.\r\n\r\n### Dump production billing data\r\n\r\n```\r\n./scripts/cf_subshell_scoped_login.sh prod\r\ncf target -o admin -s billing\r\ncf conduit billing-db -- \\\r\n  docker run -ti \\\r\n    -e PGDATABASE \\\r\n    -e PGUSER \\\r\n    -e PGPASSWORD \\\r\n    -e PGPORT \\\r\n    -e PGHOST=docker.for.mac.localhost \\\r\n    --name billing-dump \\\r\n    postgres:9.6-alpine \\\r\n    pg_dump -Fc -f billing.dump\r\ndocker cp billing-dump:billing.dump .\r\ndocker rm -f billing-dump\r\n```\r\n\r\n### Start the database server\r\n\r\n```\r\ndocker run --name billing -e POSTGRES_PASSWORD= -p 5432:5432 -d postgres:9.6-alpine\r\n```\r\n\r\n### Import the billing data dump\r\n```\r\ndocker cp billing.dump billing:/\r\ndocker exec -ti billing pg_restore --create --clean --no-privileges --no-owner -f billing.sql billing.dump\r\ndocker cp billing:/billing.sql .\r\nvi billing.sql # remove reassign_owned() references\r\ndocker cp billing.sql billing:/\r\ndocker exec -ti billing sh -c 'psql -U postgres < billing.sql'\r\n```\r\n\r\n### Run the billing app locally\r\n```\r\nDATABASE_URL=postgres://postgres:@localhost:5432/rdsbroker_b946a69b_76f4_4cbc_80df_5cee2d54b7ad?sslmode=disable make run-dev\r\n```\r\n\r\nTrigger a view refresh. Restarting the app should do this. Ensure there are no errors in the logs, and ideally ensure that the data has changed in the billable view.\r\n\r\n## Merging\r\n\r\nOnce this PR is merged, please update the temp commit on https://github.com/alphagov/paas-cf/pull/1239 with the tag value from CI and merge to release to production.\r\n\r\n## Who can review\r\n\r\nNot @camelpunch or @LeePorte "},"comment":{"url":"https://api.github.com/repos/alphagov/paas-billing/issues/comments/367649886","html_url":"https://github.com/alphagov/paas-billing/pull/14#issuecomment-367649886","issue_url":"https://api.github.com/repos/alphagov/paas-billing/issues/14","id":367649886,"user":{"login":"LeePorte","id":922815,"avatar_url":"https://avatars0.githubusercontent.com/u/922815?v=4","gravatar_id":"","url":"https://api.github.com/users/LeePorte","html_url":"https://github.com/LeePorte","followers_url":"https://api.github.com/users/LeePorte/followers","following_url":"https://api.github.com/users/LeePorte/following{/other_user}","gists_url":"https://api.github.com/users/LeePorte/gists{/gist_id}","starred_url":"https://api.github.com/users/LeePorte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeePorte/subscriptions","organizations_url":"https://api.github.com/users/LeePorte/orgs","repos_url":"https://api.github.com/users/LeePorte/repos","events_url":"https://api.github.com/users/LeePorte/events{/privacy}","received_events_url":"https://api.github.com/users/LeePorte/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T11:16:40Z","updated_at":"2018-02-22T11:16:40Z","author_association":"MEMBER","body":"https://wiki.postgresql.org/wiki/Lock_Monitoring"}}
{"actor":{"display_login":"LeePorte"}}