{"action":"opened","number":120,"pull_request":{"url":"https://api.github.com/repos/mysociety/popit-api/pulls/120","id":28204273,"html_url":"https://github.com/mysociety/popit-api/pull/120","diff_url":"https://github.com/mysociety/popit-api/pull/120.diff","patch_url":"https://github.com/mysociety/popit-api/pull/120.patch","issue_url":"https://api.github.com/repos/mysociety/popit-api/issues/120","number":120,"state":"open","locked":false,"title":"Fix url generation race condition","user":{"login":"chrismytton","id":22996,"avatar_url":"https://avatars.githubusercontent.com/u/22996?v=3","gravatar_id":"","url":"https://api.github.com/users/chrismytton","html_url":"https://github.com/chrismytton","followers_url":"https://api.github.com/users/chrismytton/followers","following_url":"https://api.github.com/users/chrismytton/following{/other_user}","gists_url":"https://api.github.com/users/chrismytton/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismytton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismytton/subscriptions","organizations_url":"https://api.github.com/users/chrismytton/orgs","repos_url":"https://api.github.com/users/chrismytton/repos","events_url":"https://api.github.com/users/chrismytton/events{/privacy}","received_events_url":"https://api.github.com/users/chrismytton/received_events","type":"User","site_admin":false},"body":"Previously we were using `eachSchema` and `schema.options.toJSON` to set various configuration options which affected how the json was rendered by mongoose's `toJSON` method. This was a flawed approach because data could leak between requests if two instances were setting different option simultaneously.\r\n\r\nThis pull request moves the url generation into a `transform.js` module, which fixes the race condition with url generation and also should make it reasonably trivial to fix https://github.com/mysociety/popit-api/issues/119.\r\n\r\nFixes https://github.com/mysociety/popit/issues/729","created_at":"2015-01-28T15:55:48Z","updated_at":"2015-01-28T15:55:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29dcf167ff67e632312630634d9491f73300498e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mysociety/popit-api/pulls/120/commits","review_comments_url":"https://api.github.com/repos/mysociety/popit-api/pulls/120/comments","review_comment_url":"https://api.github.com/repos/mysociety/popit-api/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mysociety/popit-api/issues/120/comments","statuses_url":"https://api.github.com/repos/mysociety/popit-api/statuses/d37c5a0a59241b5382d704b52fed12833d953d0d","head":{"label":"mysociety:729-pagination-race-condition","ref":"729-pagination-race-condition","sha":"d37c5a0a59241b5382d704b52fed12833d953d0d","user":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?v=3","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"repo":{"id":8774507,"name":"popit-api","full_name":"mysociety/popit-api","owner":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?v=3","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysociety/popit-api","description":"PopIt API code - can be used as a standalone PopIt/Popolo API server or embedded in an Express website","fork":false,"url":"https://api.github.com/repos/mysociety/popit-api","forks_url":"https://api.github.com/repos/mysociety/popit-api/forks","keys_url":"https://api.github.com/repos/mysociety/popit-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysociety/popit-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysociety/popit-api/teams","hooks_url":"https://api.github.com/repos/mysociety/popit-api/hooks","issue_events_url":"https://api.github.com/repos/mysociety/popit-api/issues/events{/number}","events_url":"https://api.github.com/repos/mysociety/popit-api/events","assignees_url":"https://api.github.com/repos/mysociety/popit-api/assignees{/user}","branches_url":"https://api.github.com/repos/mysociety/popit-api/branches{/branch}","tags_url":"https://api.github.com/repos/mysociety/popit-api/tags","blobs_url":"https://api.github.com/repos/mysociety/popit-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysociety/popit-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysociety/popit-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysociety/popit-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysociety/popit-api/statuses/{sha}","languages_url":"https://api.github.com/repos/mysociety/popit-api/languages","stargazers_url":"https://api.github.com/repos/mysociety/popit-api/stargazers","contributors_url":"https://api.github.com/repos/mysociety/popit-api/contributors","subscribers_url":"https://api.github.com/repos/mysociety/popit-api/subscribers","subscription_url":"https://api.github.com/repos/mysociety/popit-api/subscription","commits_url":"https://api.github.com/repos/mysociety/popit-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysociety/popit-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysociety/popit-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysociety/popit-api/issues/comments/{number}","contents_url":"https://api.github.com/repos/mysociety/popit-api/contents/{+path}","compare_url":"https://api.github.com/repos/mysociety/popit-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysociety/popit-api/merges","archive_url":"https://api.github.com/repos/mysociety/popit-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysociety/popit-api/downloads","issues_url":"https://api.github.com/repos/mysociety/popit-api/issues{/number}","pulls_url":"https://api.github.com/repos/mysociety/popit-api/pulls{/number}","milestones_url":"https://api.github.com/repos/mysociety/popit-api/milestones{/number}","notifications_url":"https://api.github.com/repos/mysociety/popit-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysociety/popit-api/labels{/name}","releases_url":"https://api.github.com/repos/mysociety/popit-api/releases{/id}","created_at":"2013-03-14T12:15:34Z","updated_at":"2015-01-23T14:37:31Z","pushed_at":"2015-01-28T15:52:05Z","git_url":"git://github.com/mysociety/popit-api.git","ssh_url":"git@github.com:mysociety/popit-api.git","clone_url":"https://github.com/mysociety/popit-api.git","svn_url":"https://github.com/mysociety/popit-api","homepage":null,"size":2354,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":31,"forks":2,"open_issues":31,"watchers":11,"default_branch":"master"}},"base":{"label":"mysociety:master","ref":"master","sha":"1ef8d3c186d7ecb9774213910ac6afd82338f279","user":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?v=3","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"repo":{"id":8774507,"name":"popit-api","full_name":"mysociety/popit-api","owner":{"login":"mysociety","id":141338,"avatar_url":"https://avatars.githubusercontent.com/u/141338?v=3","gravatar_id":"","url":"https://api.github.com/users/mysociety","html_url":"https://github.com/mysociety","followers_url":"https://api.github.com/users/mysociety/followers","following_url":"https://api.github.com/users/mysociety/following{/other_user}","gists_url":"https://api.github.com/users/mysociety/gists{/gist_id}","starred_url":"https://api.github.com/users/mysociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysociety/subscriptions","organizations_url":"https://api.github.com/users/mysociety/orgs","repos_url":"https://api.github.com/users/mysociety/repos","events_url":"https://api.github.com/users/mysociety/events{/privacy}","received_events_url":"https://api.github.com/users/mysociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysociety/popit-api","description":"PopIt API code - can be used as a standalone PopIt/Popolo API server or embedded in an Express website","fork":false,"url":"https://api.github.com/repos/mysociety/popit-api","forks_url":"https://api.github.com/repos/mysociety/popit-api/forks","keys_url":"https://api.github.com/repos/mysociety/popit-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysociety/popit-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysociety/popit-api/teams","hooks_url":"https://api.github.com/repos/mysociety/popit-api/hooks","issue_events_url":"https://api.github.com/repos/mysociety/popit-api/issues/events{/number}","events_url":"https://api.github.com/repos/mysociety/popit-api/events","assignees_url":"https://api.github.com/repos/mysociety/popit-api/assignees{/user}","branches_url":"https://api.github.com/repos/mysociety/popit-api/branches{/branch}","tags_url":"https://api.github.com/repos/mysociety/popit-api/tags","blobs_url":"https://api.github.com/repos/mysociety/popit-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysociety/popit-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysociety/popit-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysociety/popit-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysociety/popit-api/statuses/{sha}","languages_url":"https://api.github.com/repos/mysociety/popit-api/languages","stargazers_url":"https://api.github.com/repos/mysociety/popit-api/stargazers","contributors_url":"https://api.github.com/repos/mysociety/popit-api/contributors","subscribers_url":"https://api.github.com/repos/mysociety/popit-api/subscribers","subscription_url":"https://api.github.com/repos/mysociety/popit-api/subscription","commits_url":"https://api.github.com/repos/mysociety/popit-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysociety/popit-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysociety/popit-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysociety/popit-api/issues/comments/{number}","contents_url":"https://api.github.com/repos/mysociety/popit-api/contents/{+path}","compare_url":"https://api.github.com/repos/mysociety/popit-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysociety/popit-api/merges","archive_url":"https://api.github.com/repos/mysociety/popit-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysociety/popit-api/downloads","issues_url":"https://api.github.com/repos/mysociety/popit-api/issues{/number}","pulls_url":"https://api.github.com/repos/mysociety/popit-api/pulls{/number}","milestones_url":"https://api.github.com/repos/mysociety/popit-api/milestones{/number}","notifications_url":"https://api.github.com/repos/mysociety/popit-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysociety/popit-api/labels{/name}","releases_url":"https://api.github.com/repos/mysociety/popit-api/releases{/id}","created_at":"2013-03-14T12:15:34Z","updated_at":"2015-01-23T14:37:31Z","pushed_at":"2015-01-28T15:52:05Z","git_url":"git://github.com/mysociety/popit-api.git","ssh_url":"git@github.com:mysociety/popit-api.git","clone_url":"https://github.com/mysociety/popit-api.git","svn_url":"https://github.com/mysociety/popit-api","homepage":null,"size":2354,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":31,"forks":2,"open_issues":31,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mysociety/popit-api/pulls/120"},"html":{"href":"https://github.com/mysociety/popit-api/pull/120"},"issue":{"href":"https://api.github.com/repos/mysociety/popit-api/issues/120"},"comments":{"href":"https://api.github.com/repos/mysociety/popit-api/issues/120/comments"},"review_comments":{"href":"https://api.github.com/repos/mysociety/popit-api/pulls/120/comments"},"review_comment":{"href":"https://api.github.com/repos/mysociety/popit-api/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mysociety/popit-api/pulls/120/commits"},"statuses":{"href":"https://api.github.com/repos/mysociety/popit-api/statuses/d37c5a0a59241b5382d704b52fed12833d953d0d"}},"merged":false,"mergeable":true,"mergeable_state":"unstable","merged_by":null,"comments":0,"review_comments":0,"commits":4,"additions":136,"deletions":104,"changed_files":13}}