{"action":"opened","number":48,"pull_request":{"url":"https://api.github.com/repos/openshift/test-pull-requests/pulls/48","id":116855858,"html_url":"https://github.com/openshift/test-pull-requests/pull/48","diff_url":"https://github.com/openshift/test-pull-requests/pull/48.diff","patch_url":"https://github.com/openshift/test-pull-requests/pull/48.patch","issue_url":"https://api.github.com/repos/openshift/test-pull-requests/issues/48","number":48,"state":"open","locked":false,"title":"[WIP] Obtain/use GH API rate limit more efficiently","user":{"login":"dobbymoodge","id":1537044,"avatar_url":"https://avatars2.githubusercontent.com/u/1537044?v=3","gravatar_id":"","url":"https://api.github.com/users/dobbymoodge","html_url":"https://github.com/dobbymoodge","followers_url":"https://api.github.com/users/dobbymoodge/followers","following_url":"https://api.github.com/users/dobbymoodge/following{/other_user}","gists_url":"https://api.github.com/users/dobbymoodge/gists{/gist_id}","starred_url":"https://api.github.com/users/dobbymoodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobbymoodge/subscriptions","organizations_url":"https://api.github.com/users/dobbymoodge/orgs","repos_url":"https://api.github.com/users/dobbymoodge/repos","events_url":"https://api.github.com/users/dobbymoodge/events{/privacy}","received_events_url":"https://api.github.com/users/dobbymoodge/received_events","type":"User","site_admin":false},"body":"Every GitHub API response header includes the remaining rate limit in\r\nthe `X-RateLimit-Remaining` header line. This commit updates an instance\r\nvariable `@rate_limit_remaining` with the remaining rate limit on each\r\nAPI request. and provides an accessor method to handle the case where no\r\nrequests have yet been made.\r\n\r\nThis allows refactoring the rate limit backoff logic, the code that\r\ndefers processing pull requests when we're too close to the rate limit.\r\nThat logic now wraps the call to `process_pull_requests` in the main\r\ncode path.\r\n\r\nThis also adds a trailing rate limit message so we can better grasp how\r\nmany API calls we're making during an average `process_pull_requests` run.\r\n\r\nAlso also:\r\n* `rate_limit_reset` is updated alongside `rate_limit_remaining`. It's\r\n  the seconds since epoch UTC until the next rate limit reset.\r\n* `--rate_limit` option displays (cost free) the current rate limit\r\n  stats","created_at":"2017-04-20T20:20:10Z","updated_at":"2017-04-20T20:20:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/test-pull-requests/pulls/48/commits","review_comments_url":"https://api.github.com/repos/openshift/test-pull-requests/pulls/48/comments","review_comment_url":"https://api.github.com/repos/openshift/test-pull-requests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/test-pull-requests/issues/48/comments","statuses_url":"https://api.github.com/repos/openshift/test-pull-requests/statuses/eb0fc4f67704554ce96fe653874c58413024a94a","head":{"label":"dobbymoodge:rate_limit_refactor","ref":"rate_limit_refactor","sha":"eb0fc4f67704554ce96fe653874c58413024a94a","user":{"login":"dobbymoodge","id":1537044,"avatar_url":"https://avatars2.githubusercontent.com/u/1537044?v=3","gravatar_id":"","url":"https://api.github.com/users/dobbymoodge","html_url":"https://github.com/dobbymoodge","followers_url":"https://api.github.com/users/dobbymoodge/followers","following_url":"https://api.github.com/users/dobbymoodge/following{/other_user}","gists_url":"https://api.github.com/users/dobbymoodge/gists{/gist_id}","starred_url":"https://api.github.com/users/dobbymoodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobbymoodge/subscriptions","organizations_url":"https://api.github.com/users/dobbymoodge/orgs","repos_url":"https://api.github.com/users/dobbymoodge/repos","events_url":"https://api.github.com/users/dobbymoodge/events{/privacy}","received_events_url":"https://api.github.com/users/dobbymoodge/received_events","type":"User","site_admin":false},"repo":{"id":15808954,"name":"test-pull-requests","full_name":"dobbymoodge/test-pull-requests","owner":{"login":"dobbymoodge","id":1537044,"avatar_url":"https://avatars2.githubusercontent.com/u/1537044?v=3","gravatar_id":"","url":"https://api.github.com/users/dobbymoodge","html_url":"https://github.com/dobbymoodge","followers_url":"https://api.github.com/users/dobbymoodge/followers","following_url":"https://api.github.com/users/dobbymoodge/following{/other_user}","gists_url":"https://api.github.com/users/dobbymoodge/gists{/gist_id}","starred_url":"https://api.github.com/users/dobbymoodge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dobbymoodge/subscriptions","organizations_url":"https://api.github.com/users/dobbymoodge/orgs","repos_url":"https://api.github.com/users/dobbymoodge/repos","events_url":"https://api.github.com/users/dobbymoodge/events{/privacy}","received_events_url":"https://api.github.com/users/dobbymoodge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dobbymoodge/test-pull-requests","description":"Utility for serially testing then merging pull requests in conjunction with Jenkins.","fork":true,"url":"https://api.github.com/repos/dobbymoodge/test-pull-requests","forks_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/forks","keys_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/teams","hooks_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/hooks","issue_events_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/issues/events{/number}","events_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/events","assignees_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/assignees{/user}","branches_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/branches{/branch}","tags_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/tags","blobs_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/git/refs{/sha}","trees_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/statuses/{sha}","languages_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/languages","stargazers_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/stargazers","contributors_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/contributors","subscribers_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/subscribers","subscription_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/subscription","commits_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/commits{/sha}","git_commits_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/git/commits{/sha}","comments_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/comments{/number}","issue_comment_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/issues/comments{/number}","contents_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/contents/{+path}","compare_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/merges","archive_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/downloads","issues_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/issues{/number}","pulls_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/pulls{/number}","milestones_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/milestones{/number}","notifications_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/labels{/name}","releases_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/releases{/id}","deployments_url":"https://api.github.com/repos/dobbymoodge/test-pull-requests/deployments","created_at":"2014-01-10T20:36:01Z","updated_at":"2014-06-26T19:27:50Z","pushed_at":"2017-04-20T20:19:43Z","git_url":"git://github.com/dobbymoodge/test-pull-requests.git","ssh_url":"git@github.com:dobbymoodge/test-pull-requests.git","clone_url":"https://github.com/dobbymoodge/test-pull-requests.git","svn_url":"https://github.com/dobbymoodge/test-pull-requests","homepage":null,"size":314,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"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":"openshift:master","ref":"master","sha":"fa61eaa91c677356b9a31442eba48df2ba15c255","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars0.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":5604195,"name":"test-pull-requests","full_name":"openshift/test-pull-requests","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars0.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/test-pull-requests","description":"Utility for serially testing then merging pull requests in conjunction with Jenkins.","fork":false,"url":"https://api.github.com/repos/openshift/test-pull-requests","forks_url":"https://api.github.com/repos/openshift/test-pull-requests/forks","keys_url":"https://api.github.com/repos/openshift/test-pull-requests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/test-pull-requests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/test-pull-requests/teams","hooks_url":"https://api.github.com/repos/openshift/test-pull-requests/hooks","issue_events_url":"https://api.github.com/repos/openshift/test-pull-requests/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/test-pull-requests/events","assignees_url":"https://api.github.com/repos/openshift/test-pull-requests/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/test-pull-requests/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/test-pull-requests/tags","blobs_url":"https://api.github.com/repos/openshift/test-pull-requests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/test-pull-requests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/test-pull-requests/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/test-pull-requests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/test-pull-requests/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/test-pull-requests/languages","stargazers_url":"https://api.github.com/repos/openshift/test-pull-requests/stargazers","contributors_url":"https://api.github.com/repos/openshift/test-pull-requests/contributors","subscribers_url":"https://api.github.com/repos/openshift/test-pull-requests/subscribers","subscription_url":"https://api.github.com/repos/openshift/test-pull-requests/subscription","commits_url":"https://api.github.com/repos/openshift/test-pull-requests/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/test-pull-requests/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/test-pull-requests/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/test-pull-requests/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/test-pull-requests/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/test-pull-requests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/test-pull-requests/merges","archive_url":"https://api.github.com/repos/openshift/test-pull-requests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/test-pull-requests/downloads","issues_url":"https://api.github.com/repos/openshift/test-pull-requests/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/test-pull-requests/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/test-pull-requests/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/test-pull-requests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/test-pull-requests/labels{/name}","releases_url":"https://api.github.com/repos/openshift/test-pull-requests/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/test-pull-requests/deployments","created_at":"2012-08-29T17:45:58Z","updated_at":"2017-04-19T14:43:05Z","pushed_at":"2017-02-27T14:56:30Z","git_url":"git://github.com/openshift/test-pull-requests.git","ssh_url":"git@github.com:openshift/test-pull-requests.git","clone_url":"https://github.com/openshift/test-pull-requests.git","svn_url":"https://github.com/openshift/test-pull-requests","homepage":null,"size":305,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":4,"forks":22,"open_issues":4,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/test-pull-requests/pulls/48"},"html":{"href":"https://github.com/openshift/test-pull-requests/pull/48"},"issue":{"href":"https://api.github.com/repos/openshift/test-pull-requests/issues/48"},"comments":{"href":"https://api.github.com/repos/openshift/test-pull-requests/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/test-pull-requests/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/test-pull-requests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/test-pull-requests/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/test-pull-requests/statuses/eb0fc4f67704554ce96fe653874c58413024a94a"}},"merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":36,"deletions":8,"changed_files":1}}
{"actor":{"display_login":"dobbymoodge"}}