{"action":"created","comment":{"url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/comments/24268928","id":24268928,"diff_hunk":"@@ -13,14 +13,25 @@ def index(gh_type, client, repo_name):\n     indexed_timestamp = helpers.get_indexed_version(gh_type, repo_name, obj_type)\n     # increment timestamp by one second to prevent duplicates\n     indexed_timestamp = nudge_datetime(indexed_timestamp)\n-    bulk_data = index_gh_issues(gh_type, client, repo_name, indexed_timestamp)\n-    bulk_data += index_gh_issue_comments(gh_type, client, repo_name, indexed_timestamp)\n-    helpers.update_repo_index(gh_type, repo_name, obj_type, bulk_data)\n+    bulk_data = []\n+    if is_updated_issues(client, repo_name, indexed_timestamp):\n+        bulk_data += index_gh_issues(gh_type, client, repo_name)\n+        bulk_data += index_gh_issue_comments(gh_type, client, repo_name)\n+        helpers.rebuild_repo_index(gh_type, repo_name, obj_type, bulk_data)\n+    else:\n+        print '%s (%s): skipping %s' % (repo_name, gh_type, obj_type)\n     end = time.mktime(datetime.now().timetuple())\n     print '%s: %s github issues (%s secs)' % (repo_name, len(bulk_data)/2, end-start)\n \n \n-def index_gh_issues(gh_type, client, repo_name, since):\n+def is_updated_issues(client, repo_name, since):\n+    (owner, repo) = repo_name.split('/')\n+    issues = client.repos._(owner)._(repo).issues.params(\n+        state='all', since=since)\n+    return True if issues.get().json() else False","path":"server/indexers/gh_issues.py","position":23,"original_position":23,"commit_id":"c9a74b0260eccde2c2ec95c79740dcaffa806231","original_commit_id":"c9a74b0260eccde2c2ec95c79740dcaffa806231","user":{"login":"dgreisen-cfpb","id":6369769,"avatar_url":"https://avatars.githubusercontent.com/u/6369769?v=3","gravatar_id":"","url":"https://api.github.com/users/dgreisen-cfpb","html_url":"https://github.com/dgreisen-cfpb","followers_url":"https://api.github.com/users/dgreisen-cfpb/followers","following_url":"https://api.github.com/users/dgreisen-cfpb/following{/other_user}","gists_url":"https://api.github.com/users/dgreisen-cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/dgreisen-cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgreisen-cfpb/subscriptions","organizations_url":"https://api.github.com/users/dgreisen-cfpb/orgs","repos_url":"https://api.github.com/users/dgreisen-cfpb/repos","events_url":"https://api.github.com/users/dgreisen-cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/dgreisen-cfpb/received_events","type":"User","site_admin":false},"body":"deserializing json is a really slow way to see if it return a 304.\r\n\r\n    return issues.get().status_code != 304","created_at":"2015-02-06T20:20:29Z","updated_at":"2015-02-06T20:20:29Z","html_url":"https://github.com/cfpb/github-wiki-search/pull/71#discussion_r24268928","pull_request_url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/comments/24268928"},"html":{"href":"https://github.com/cfpb/github-wiki-search/pull/71#discussion_r24268928"},"pull_request":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71","id":28837243,"html_url":"https://github.com/cfpb/github-wiki-search/pull/71","diff_url":"https://github.com/cfpb/github-wiki-search/pull/71.diff","patch_url":"https://github.com/cfpb/github-wiki-search/pull/71.patch","issue_url":"https://api.github.com/repos/cfpb/github-wiki-search/issues/71","number":71,"state":"open","locked":false,"title":"github issues completely rebuild if an update is found","user":{"login":"m3brown","id":2699164,"avatar_url":"https://avatars.githubusercontent.com/u/2699164?v=3","gravatar_id":"","url":"https://api.github.com/users/m3brown","html_url":"https://github.com/m3brown","followers_url":"https://api.github.com/users/m3brown/followers","following_url":"https://api.github.com/users/m3brown/following{/other_user}","gists_url":"https://api.github.com/users/m3brown/gists{/gist_id}","starred_url":"https://api.github.com/users/m3brown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3brown/subscriptions","organizations_url":"https://api.github.com/users/m3brown/orgs","repos_url":"https://api.github.com/users/m3brown/repos","events_url":"https://api.github.com/users/m3brown/events{/privacy}","received_events_url":"https://api.github.com/users/m3brown/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-06T19:59:11Z","updated_at":"2015-02-06T20:20:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b538338dfed2cc5663969eeed998fdcfe3df59d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71/commits","review_comments_url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71/comments","review_comment_url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cfpb/github-wiki-search/issues/71/comments","statuses_url":"https://api.github.com/repos/cfpb/github-wiki-search/statuses/c9a74b0260eccde2c2ec95c79740dcaffa806231","head":{"label":"m3brown:gh-issues","ref":"gh-issues","sha":"c9a74b0260eccde2c2ec95c79740dcaffa806231","user":{"login":"m3brown","id":2699164,"avatar_url":"https://avatars.githubusercontent.com/u/2699164?v=3","gravatar_id":"","url":"https://api.github.com/users/m3brown","html_url":"https://github.com/m3brown","followers_url":"https://api.github.com/users/m3brown/followers","following_url":"https://api.github.com/users/m3brown/following{/other_user}","gists_url":"https://api.github.com/users/m3brown/gists{/gist_id}","starred_url":"https://api.github.com/users/m3brown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3brown/subscriptions","organizations_url":"https://api.github.com/users/m3brown/orgs","repos_url":"https://api.github.com/users/m3brown/repos","events_url":"https://api.github.com/users/m3brown/events{/privacy}","received_events_url":"https://api.github.com/users/m3brown/received_events","type":"User","site_admin":false},"repo":{"id":30022004,"name":"github-wiki-search","full_name":"m3brown/github-wiki-search","owner":{"login":"m3brown","id":2699164,"avatar_url":"https://avatars.githubusercontent.com/u/2699164?v=3","gravatar_id":"","url":"https://api.github.com/users/m3brown","html_url":"https://github.com/m3brown","followers_url":"https://api.github.com/users/m3brown/followers","following_url":"https://api.github.com/users/m3brown/following{/other_user}","gists_url":"https://api.github.com/users/m3brown/gists{/gist_id}","starred_url":"https://api.github.com/users/m3brown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m3brown/subscriptions","organizations_url":"https://api.github.com/users/m3brown/orgs","repos_url":"https://api.github.com/users/m3brown/repos","events_url":"https://api.github.com/users/m3brown/events{/privacy}","received_events_url":"https://api.github.com/users/m3brown/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/m3brown/github-wiki-search","description":"","fork":true,"url":"https://api.github.com/repos/m3brown/github-wiki-search","forks_url":"https://api.github.com/repos/m3brown/github-wiki-search/forks","keys_url":"https://api.github.com/repos/m3brown/github-wiki-search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/m3brown/github-wiki-search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/m3brown/github-wiki-search/teams","hooks_url":"https://api.github.com/repos/m3brown/github-wiki-search/hooks","issue_events_url":"https://api.github.com/repos/m3brown/github-wiki-search/issues/events{/number}","events_url":"https://api.github.com/repos/m3brown/github-wiki-search/events","assignees_url":"https://api.github.com/repos/m3brown/github-wiki-search/assignees{/user}","branches_url":"https://api.github.com/repos/m3brown/github-wiki-search/branches{/branch}","tags_url":"https://api.github.com/repos/m3brown/github-wiki-search/tags","blobs_url":"https://api.github.com/repos/m3brown/github-wiki-search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/m3brown/github-wiki-search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/m3brown/github-wiki-search/git/refs{/sha}","trees_url":"https://api.github.com/repos/m3brown/github-wiki-search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/m3brown/github-wiki-search/statuses/{sha}","languages_url":"https://api.github.com/repos/m3brown/github-wiki-search/languages","stargazers_url":"https://api.github.com/repos/m3brown/github-wiki-search/stargazers","contributors_url":"https://api.github.com/repos/m3brown/github-wiki-search/contributors","subscribers_url":"https://api.github.com/repos/m3brown/github-wiki-search/subscribers","subscription_url":"https://api.github.com/repos/m3brown/github-wiki-search/subscription","commits_url":"https://api.github.com/repos/m3brown/github-wiki-search/commits{/sha}","git_commits_url":"https://api.github.com/repos/m3brown/github-wiki-search/git/commits{/sha}","comments_url":"https://api.github.com/repos/m3brown/github-wiki-search/comments{/number}","issue_comment_url":"https://api.github.com/repos/m3brown/github-wiki-search/issues/comments/{number}","contents_url":"https://api.github.com/repos/m3brown/github-wiki-search/contents/{+path}","compare_url":"https://api.github.com/repos/m3brown/github-wiki-search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/m3brown/github-wiki-search/merges","archive_url":"https://api.github.com/repos/m3brown/github-wiki-search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/m3brown/github-wiki-search/downloads","issues_url":"https://api.github.com/repos/m3brown/github-wiki-search/issues{/number}","pulls_url":"https://api.github.com/repos/m3brown/github-wiki-search/pulls{/number}","milestones_url":"https://api.github.com/repos/m3brown/github-wiki-search/milestones{/number}","notifications_url":"https://api.github.com/repos/m3brown/github-wiki-search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/m3brown/github-wiki-search/labels{/name}","releases_url":"https://api.github.com/repos/m3brown/github-wiki-search/releases{/id}","created_at":"2015-01-29T13:50:54Z","updated_at":"2015-02-06T20:00:15Z","pushed_at":"2015-02-06T20:12:47Z","git_url":"git://github.com/m3brown/github-wiki-search.git","ssh_url":"git@github.com:m3brown/github-wiki-search.git","clone_url":"https://github.com/m3brown/github-wiki-search.git","svn_url":"https://github.com/m3brown/github-wiki-search","homepage":null,"size":1291,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cfpb:master","ref":"master","sha":"9155d76618fddf1cfa0fe9be4eb8f235cb58addc","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":17216762,"name":"github-wiki-search","full_name":"cfpb/github-wiki-search","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/github-wiki-search","description":"","fork":false,"url":"https://api.github.com/repos/cfpb/github-wiki-search","forks_url":"https://api.github.com/repos/cfpb/github-wiki-search/forks","keys_url":"https://api.github.com/repos/cfpb/github-wiki-search/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/github-wiki-search/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/github-wiki-search/teams","hooks_url":"https://api.github.com/repos/cfpb/github-wiki-search/hooks","issue_events_url":"https://api.github.com/repos/cfpb/github-wiki-search/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/github-wiki-search/events","assignees_url":"https://api.github.com/repos/cfpb/github-wiki-search/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/github-wiki-search/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/github-wiki-search/tags","blobs_url":"https://api.github.com/repos/cfpb/github-wiki-search/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/github-wiki-search/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/github-wiki-search/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/github-wiki-search/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/github-wiki-search/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/github-wiki-search/languages","stargazers_url":"https://api.github.com/repos/cfpb/github-wiki-search/stargazers","contributors_url":"https://api.github.com/repos/cfpb/github-wiki-search/contributors","subscribers_url":"https://api.github.com/repos/cfpb/github-wiki-search/subscribers","subscription_url":"https://api.github.com/repos/cfpb/github-wiki-search/subscription","commits_url":"https://api.github.com/repos/cfpb/github-wiki-search/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/github-wiki-search/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/github-wiki-search/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/github-wiki-search/issues/comments/{number}","contents_url":"https://api.github.com/repos/cfpb/github-wiki-search/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/github-wiki-search/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/github-wiki-search/merges","archive_url":"https://api.github.com/repos/cfpb/github-wiki-search/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/github-wiki-search/downloads","issues_url":"https://api.github.com/repos/cfpb/github-wiki-search/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/github-wiki-search/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/github-wiki-search/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/github-wiki-search/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/github-wiki-search/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/github-wiki-search/releases{/id}","created_at":"2014-02-26T16:20:33Z","updated_at":"2015-02-06T19:26:08Z","pushed_at":"2015-02-06T19:26:08Z","git_url":"git://github.com/cfpb/github-wiki-search.git","ssh_url":"git@github.com:cfpb/github-wiki-search.git","clone_url":"https://github.com/cfpb/github-wiki-search.git","svn_url":"https://github.com/cfpb/github-wiki-search","homepage":null,"size":7402,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":20,"forks":8,"open_issues":20,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71"},"html":{"href":"https://github.com/cfpb/github-wiki-search/pull/71"},"issue":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/issues/71"},"comments":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/github-wiki-search/statuses/c9a74b0260eccde2c2ec95c79740dcaffa806231"}}}}