{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/kitsune/pulls/comments/44850587","id":44850587,"diff_hunk":"@@ -48,6 +38,33 @@ class DeleteError(Exception):\n     pass\n \n \n+def create_batch_id():\n+    \"\"\"Returns a batch_id\"\"\"\n+    # TODO: This is silly, but it's a good enough way to distinguish\n+    # between batches by looking at a Record. This is just over the\n+    # number of seconds in a day.\n+    return str(int(time.time()))[-6:]\n+\n+\n+def handle_reconcile(request):\n+    \"\"\"Reconcile all the things\"\"\"\n+    outstanding = Record.objects.outstanding().count()\n+    if outstanding > 0:\n+        raise ReindexError('There are %s outstanding chunks.' % outstanding)\n+\n+    batch_id = create_batch_id()\n+\n+    for cls, indexable in get_indexable():\n+        index = cls.get_index()\n+        doc_type = cls.get_mapping_type_name()\n+        chunk_name = 'Reconciling: %s' % doc_type\n+        rec = Record(batch_id=batch_id, name=chunk_name)\n+        rec.save()","path":"kitsune/search/admin.py","position":67,"original_position":67,"commit_id":"9d15df7c201ccc4940d4376e34c45d86bb8d418b","original_commit_id":"9d15df7c201ccc4940d4376e34c45d86bb8d418b","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars.githubusercontent.com/u/305049?v=3","gravatar_id":"","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"body":"Any reason not to use `Record.objects.create(batch_id=batch_id, name=chunk_name)` instead of the two line version?","created_at":"2015-11-14T00:55:49Z","updated_at":"2015-11-14T00:55:49Z","html_url":"https://github.com/mozilla/kitsune/pull/2717#discussion_r44850587","pull_request_url":"https://api.github.com/repos/mozilla/kitsune/pulls/2717","_links":{"self":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/comments/44850587"},"html":{"href":"https://github.com/mozilla/kitsune/pull/2717#discussion_r44850587"},"pull_request":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2717"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/kitsune/pulls/2717","id":50424487,"html_url":"https://github.com/mozilla/kitsune/pull/2717","diff_url":"https://github.com/mozilla/kitsune/pull/2717.diff","patch_url":"https://github.com/mozilla/kitsune/pull/2717.patch","issue_url":"https://api.github.com/repos/mozilla/kitsune/issues/2717","number":2717,"state":"open","locked":false,"title":"917754 indexing","user":{"login":"willkg","id":820826,"avatar_url":"https://avatars.githubusercontent.com/u/820826?v=3","gravatar_id":"","url":"https://api.github.com/users/willkg","html_url":"https://github.com/willkg","followers_url":"https://api.github.com/users/willkg/followers","following_url":"https://api.github.com/users/willkg/following{/other_user}","gists_url":"https://api.github.com/users/willkg/gists{/gist_id}","starred_url":"https://api.github.com/users/willkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willkg/subscriptions","organizations_url":"https://api.github.com/users/willkg/orgs","repos_url":"https://api.github.com/users/willkg/repos","events_url":"https://api.github.com/users/willkg/events{/privacy}","received_events_url":"https://api.github.com/users/willkg/received_events","type":"User","site_admin":false},"body":"r?","created_at":"2015-11-11T19:25:01Z","updated_at":"2015-11-14T00:55:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78a2f524c40faf5e6c586df0404fd1a05e1987cb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/kitsune/pulls/2717/commits","review_comments_url":"https://api.github.com/repos/mozilla/kitsune/pulls/2717/comments","review_comment_url":"https://api.github.com/repos/mozilla/kitsune/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/kitsune/issues/2717/comments","statuses_url":"https://api.github.com/repos/mozilla/kitsune/statuses/9d15df7c201ccc4940d4376e34c45d86bb8d418b","head":{"label":"willkg:917754-indexing","ref":"917754-indexing","sha":"9d15df7c201ccc4940d4376e34c45d86bb8d418b","user":{"login":"willkg","id":820826,"avatar_url":"https://avatars.githubusercontent.com/u/820826?v=3","gravatar_id":"","url":"https://api.github.com/users/willkg","html_url":"https://github.com/willkg","followers_url":"https://api.github.com/users/willkg/followers","following_url":"https://api.github.com/users/willkg/following{/other_user}","gists_url":"https://api.github.com/users/willkg/gists{/gist_id}","starred_url":"https://api.github.com/users/willkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willkg/subscriptions","organizations_url":"https://api.github.com/users/willkg/orgs","repos_url":"https://api.github.com/users/willkg/repos","events_url":"https://api.github.com/users/willkg/events{/privacy}","received_events_url":"https://api.github.com/users/willkg/received_events","type":"User","site_admin":false},"repo":{"id":2334610,"name":"kitsune","full_name":"willkg/kitsune","owner":{"login":"willkg","id":820826,"avatar_url":"https://avatars.githubusercontent.com/u/820826?v=3","gravatar_id":"","url":"https://api.github.com/users/willkg","html_url":"https://github.com/willkg","followers_url":"https://api.github.com/users/willkg/followers","following_url":"https://api.github.com/users/willkg/following{/other_user}","gists_url":"https://api.github.com/users/willkg/gists{/gist_id}","starred_url":"https://api.github.com/users/willkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willkg/subscriptions","organizations_url":"https://api.github.com/users/willkg/orgs","repos_url":"https://api.github.com/users/willkg/repos","events_url":"https://api.github.com/users/willkg/events{/privacy}","received_events_url":"https://api.github.com/users/willkg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/willkg/kitsune","description":"Platform for Firefox Help","fork":true,"url":"https://api.github.com/repos/willkg/kitsune","forks_url":"https://api.github.com/repos/willkg/kitsune/forks","keys_url":"https://api.github.com/repos/willkg/kitsune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/willkg/kitsune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/willkg/kitsune/teams","hooks_url":"https://api.github.com/repos/willkg/kitsune/hooks","issue_events_url":"https://api.github.com/repos/willkg/kitsune/issues/events{/number}","events_url":"https://api.github.com/repos/willkg/kitsune/events","assignees_url":"https://api.github.com/repos/willkg/kitsune/assignees{/user}","branches_url":"https://api.github.com/repos/willkg/kitsune/branches{/branch}","tags_url":"https://api.github.com/repos/willkg/kitsune/tags","blobs_url":"https://api.github.com/repos/willkg/kitsune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/willkg/kitsune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/willkg/kitsune/git/refs{/sha}","trees_url":"https://api.github.com/repos/willkg/kitsune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/willkg/kitsune/statuses/{sha}","languages_url":"https://api.github.com/repos/willkg/kitsune/languages","stargazers_url":"https://api.github.com/repos/willkg/kitsune/stargazers","contributors_url":"https://api.github.com/repos/willkg/kitsune/contributors","subscribers_url":"https://api.github.com/repos/willkg/kitsune/subscribers","subscription_url":"https://api.github.com/repos/willkg/kitsune/subscription","commits_url":"https://api.github.com/repos/willkg/kitsune/commits{/sha}","git_commits_url":"https://api.github.com/repos/willkg/kitsune/git/commits{/sha}","comments_url":"https://api.github.com/repos/willkg/kitsune/comments{/number}","issue_comment_url":"https://api.github.com/repos/willkg/kitsune/issues/comments{/number}","contents_url":"https://api.github.com/repos/willkg/kitsune/contents/{+path}","compare_url":"https://api.github.com/repos/willkg/kitsune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/willkg/kitsune/merges","archive_url":"https://api.github.com/repos/willkg/kitsune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/willkg/kitsune/downloads","issues_url":"https://api.github.com/repos/willkg/kitsune/issues{/number}","pulls_url":"https://api.github.com/repos/willkg/kitsune/pulls{/number}","milestones_url":"https://api.github.com/repos/willkg/kitsune/milestones{/number}","notifications_url":"https://api.github.com/repos/willkg/kitsune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/willkg/kitsune/labels{/name}","releases_url":"https://api.github.com/repos/willkg/kitsune/releases{/id}","created_at":"2011-09-06T13:38:29Z","updated_at":"2015-05-06T14:07:18Z","pushed_at":"2015-11-13T01:33:21Z","git_url":"git://github.com/willkg/kitsune.git","ssh_url":"git@github.com:willkg/kitsune.git","clone_url":"https://github.com/willkg/kitsune.git","svn_url":"https://github.com/willkg/kitsune","homepage":"http://support.mozilla.com/","size":113159,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"37ca2b422ad40a17184611de43a7a7d4abf01e7d","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":489645,"name":"kitsune","full_name":"mozilla/kitsune","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/kitsune","description":"Platform for Mozilla Support","fork":false,"url":"https://api.github.com/repos/mozilla/kitsune","forks_url":"https://api.github.com/repos/mozilla/kitsune/forks","keys_url":"https://api.github.com/repos/mozilla/kitsune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/kitsune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/kitsune/teams","hooks_url":"https://api.github.com/repos/mozilla/kitsune/hooks","issue_events_url":"https://api.github.com/repos/mozilla/kitsune/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/kitsune/events","assignees_url":"https://api.github.com/repos/mozilla/kitsune/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/kitsune/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/kitsune/tags","blobs_url":"https://api.github.com/repos/mozilla/kitsune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/kitsune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/kitsune/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/kitsune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/kitsune/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/kitsune/languages","stargazers_url":"https://api.github.com/repos/mozilla/kitsune/stargazers","contributors_url":"https://api.github.com/repos/mozilla/kitsune/contributors","subscribers_url":"https://api.github.com/repos/mozilla/kitsune/subscribers","subscription_url":"https://api.github.com/repos/mozilla/kitsune/subscription","commits_url":"https://api.github.com/repos/mozilla/kitsune/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/kitsune/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/kitsune/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/kitsune/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/kitsune/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/kitsune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/kitsune/merges","archive_url":"https://api.github.com/repos/mozilla/kitsune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/kitsune/downloads","issues_url":"https://api.github.com/repos/mozilla/kitsune/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/kitsune/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/kitsune/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/kitsune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/kitsune/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/kitsune/releases{/id}","created_at":"2010-01-26T18:53:57Z","updated_at":"2015-11-13T02:38:46Z","pushed_at":"2015-11-14T00:38:15Z","git_url":"git://github.com/mozilla/kitsune.git","ssh_url":"git@github.com:mozilla/kitsune.git","clone_url":"https://github.com/mozilla/kitsune.git","svn_url":"https://github.com/mozilla/kitsune","homepage":"http://support.mozilla.com/","size":179517,"stargazers_count":318,"watchers_count":318,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":316,"mirror_url":null,"open_issues_count":6,"forks":316,"open_issues":6,"watchers":318,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2717"},"html":{"href":"https://github.com/mozilla/kitsune/pull/2717"},"issue":{"href":"https://api.github.com/repos/mozilla/kitsune/issues/2717"},"comments":{"href":"https://api.github.com/repos/mozilla/kitsune/issues/2717/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2717/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2717/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/kitsune/statuses/9d15df7c201ccc4940d4376e34c45d86bb8d418b"}}}}