{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/27733193","id":27733193,"diff_hunk":"@@ -157,6 +160,39 @@ func TestRetryController_realFifoEventOrdering(t *testing.T) {\n \t}\n }\n \n+// This test ensures that when events are retried, the\n+// requeue rate does not exceed the configured rate limit,\n+// including burst behavior.\n+func TestRetryController_ratelimit(t *testing.T) {\n+\tkeyFunc := func(obj interface{}) (string, error) {\n+\t\treturn \"key\", nil\n+\t}\n+\tfifo := kcache.NewFIFO(keyFunc)\n+\n+\tretryManager := NewQueueRetryManager(fifo,\n+\t\tkeyFunc,\n+\t\tfunc(_ interface{}, _ error, c int) bool {\n+\t\t\tif c < 15 {\n+\t\t\t\treturn true\n+\t\t\t}\n+\t\t\treturn false\n+\t\t},\n+\t\t10,\n+\t\t5)\n+\t// burst bucket is 5, so we'll run the first 5 retries\n+\t// immediately, then the remaining 11 retries will take\n+\t// 0.1s each, so the total time should not be less than\n+\t// 1s.\n+\texpectedFinish := time.Now().Add(time.Second * 1)","path":"pkg/controller/controller_test.go","position":55,"original_position":55,"commit_id":"5a82154fe1626ff4f9f94ce59eba79b50d33bf2d","original_commit_id":"5a82154fe1626ff4f9f94ce59eba79b50d33bf2d","user":{"login":"smarterclayton","id":1163175,"avatar_url":"https://avatars.githubusercontent.com/u/1163175?v=3","gravatar_id":"","url":"https://api.github.com/users/smarterclayton","html_url":"https://github.com/smarterclayton","followers_url":"https://api.github.com/users/smarterclayton/followers","following_url":"https://api.github.com/users/smarterclayton/following{/other_user}","gists_url":"https://api.github.com/users/smarterclayton/gists{/gist_id}","starred_url":"https://api.github.com/users/smarterclayton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smarterclayton/subscriptions","organizations_url":"https://api.github.com/users/smarterclayton/orgs","repos_url":"https://api.github.com/users/smarterclayton/repos","events_url":"https://api.github.com/users/smarterclayton/events{/privacy}","received_events_url":"https://api.github.com/users/smarterclayton/received_events","type":"User","site_admin":false},"body":"If you take the interface as I suggest you can test this without being dependent of clock time which is >> than waits.","created_at":"2015-04-03T14:52:19Z","updated_at":"2015-04-03T14:52:19Z","html_url":"https://github.com/openshift/origin/pull/1561#discussion_r27733193","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/1561","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/27733193"},"html":{"href":"https://github.com/openshift/origin/pull/1561#discussion_r27733193"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/1561"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/1561","id":32467201,"html_url":"https://github.com/openshift/origin/pull/1561","diff_url":"https://github.com/openshift/origin/pull/1561.diff","patch_url":"https://github.com/openshift/origin/pull/1561.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/1561","number":1561,"state":"open","locked":false,"title":"add delays when handling retries so we don't tight loop","user":{"login":"bparees","id":4974046,"avatar_url":"https://avatars.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false},"body":null,"created_at":"2015-04-01T22:25:30Z","updated_at":"2015-04-03T14:52:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6a01b4565e48e58f164084dca19e6bba023905e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/1561/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/1561/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/1561/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/5a82154fe1626ff4f9f94ce59eba79b50d33bf2d","head":{"label":"bparees:tight_loops","ref":"tight_loops","sha":"5a82154fe1626ff4f9f94ce59eba79b50d33bf2d","user":{"login":"bparees","id":4974046,"avatar_url":"https://avatars.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false},"repo":{"id":23590442,"name":"origin","full_name":"bparees/origin","owner":{"login":"bparees","id":4974046,"avatar_url":"https://avatars.githubusercontent.com/u/4974046?v=3","gravatar_id":"","url":"https://api.github.com/users/bparees","html_url":"https://github.com/bparees","followers_url":"https://api.github.com/users/bparees/followers","following_url":"https://api.github.com/users/bparees/following{/other_user}","gists_url":"https://api.github.com/users/bparees/gists{/gist_id}","starred_url":"https://api.github.com/users/bparees/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bparees/subscriptions","organizations_url":"https://api.github.com/users/bparees/orgs","repos_url":"https://api.github.com/users/bparees/repos","events_url":"https://api.github.com/users/bparees/events{/privacy}","received_events_url":"https://api.github.com/users/bparees/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bparees/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/bparees/origin","forks_url":"https://api.github.com/repos/bparees/origin/forks","keys_url":"https://api.github.com/repos/bparees/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bparees/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bparees/origin/teams","hooks_url":"https://api.github.com/repos/bparees/origin/hooks","issue_events_url":"https://api.github.com/repos/bparees/origin/issues/events{/number}","events_url":"https://api.github.com/repos/bparees/origin/events","assignees_url":"https://api.github.com/repos/bparees/origin/assignees{/user}","branches_url":"https://api.github.com/repos/bparees/origin/branches{/branch}","tags_url":"https://api.github.com/repos/bparees/origin/tags","blobs_url":"https://api.github.com/repos/bparees/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bparees/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bparees/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/bparees/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bparees/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/bparees/origin/languages","stargazers_url":"https://api.github.com/repos/bparees/origin/stargazers","contributors_url":"https://api.github.com/repos/bparees/origin/contributors","subscribers_url":"https://api.github.com/repos/bparees/origin/subscribers","subscription_url":"https://api.github.com/repos/bparees/origin/subscription","commits_url":"https://api.github.com/repos/bparees/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/bparees/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/bparees/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/bparees/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/bparees/origin/contents/{+path}","compare_url":"https://api.github.com/repos/bparees/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bparees/origin/merges","archive_url":"https://api.github.com/repos/bparees/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bparees/origin/downloads","issues_url":"https://api.github.com/repos/bparees/origin/issues{/number}","pulls_url":"https://api.github.com/repos/bparees/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/bparees/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/bparees/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bparees/origin/labels{/name}","releases_url":"https://api.github.com/repos/bparees/origin/releases{/id}","created_at":"2014-09-02T18:28:48Z","updated_at":"2015-04-03T03:45:31Z","pushed_at":"2015-04-03T04:22:20Z","git_url":"git://github.com/bparees/origin.git","ssh_url":"git@github.com:bparees/origin.git","clone_url":"https://github.com/bparees/origin.git","svn_url":"https://github.com/bparees/origin","homepage":"https://openshift.github.io","size":63512,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"45ccf49542d5cdf3e967c0777586ca90cba1d5d2","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.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":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.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/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-04-03T14:10:11Z","pushed_at":"2015-04-03T14:10:11Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":94607,"stargazers_count":348,"watchers_count":348,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":181,"mirror_url":null,"open_issues_count":155,"forks":181,"open_issues":155,"watchers":348,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/1561"},"html":{"href":"https://github.com/openshift/origin/pull/1561"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/1561"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/1561/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/1561/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/1561/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/5a82154fe1626ff4f9f94ce59eba79b50d33bf2d"}}}}