{"action":"created","comment":{"url":"https://api.github.com/repos/eapache/go-resiliency/pulls/comments/90473008","pull_request_review_id":10990322,"id":90473008,"diff_hunk":"@@ -0,0 +1,54 @@\n+package limiter\n+\n+import \"time\"\n+\n+type LeakyBucket struct {\n+\tbucket chan struct{}\n+\tquit   chan struct{}\n+}\n+\n+func (rl *LeakyBucket) fill(burst int) {\n+\tfor i := 0; i < burst; i++ {\n+\t\trl.bucket <- struct{}{}\n+\t}\n+}\n+\n+func (rl *LeakyBucket) drip(drip float64) {\n+\tdriptime := float64(1000000000) / drip\n+\tfor {\n+\t\ttime.Sleep(time.Duration(driptime) * time.Nanosecond)\n+\t\t// close\n+\t\tselect {\n+\t\tcase rl.bucket <- struct{}{}:\n+\t\tcase <-rl.quit:\n+\t\t\treturn\n+\t\tdefault:\n+\t\t\tcontinue\n+\t\t}\n+\t}\n+}\n+\n+// Close MUST be called by client when leaky bucket is not requited. Otherise will leak a goroutine.\n+func (rl *LeakyBucket) Close() {\n+\trl.quit <- struct{}{}\n+}\n+\n+// Limiter returns a read-only channel signal that will send signals according to a leaky buckety alogrithm.","path":"limiter/limiter.go","position":36,"original_position":36,"commit_id":"036ede9cdc70ec4e041c9da3eed4d475d57de492","original_commit_id":"036ede9cdc70ec4e041c9da3eed4d475d57de492","user":{"login":"eapache","id":1706826,"avatar_url":"https://avatars.githubusercontent.com/u/1706826?v=3","gravatar_id":"","url":"https://api.github.com/users/eapache","html_url":"https://github.com/eapache","followers_url":"https://api.github.com/users/eapache/followers","following_url":"https://api.github.com/users/eapache/following{/other_user}","gists_url":"https://api.github.com/users/eapache/gists{/gist_id}","starred_url":"https://api.github.com/users/eapache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eapache/subscriptions","organizations_url":"https://api.github.com/users/eapache/orgs","repos_url":"https://api.github.com/users/eapache/repos","events_url":"https://api.github.com/users/eapache/events{/privacy}","received_events_url":"https://api.github.com/users/eapache/received_events","type":"User","site_admin":false},"body":"typo","created_at":"2016-12-01T15:45:17Z","updated_at":"2016-12-01T15:45:24Z","html_url":"https://github.com/eapache/go-resiliency/pull/11#discussion_r90473008","pull_request_url":"https://api.github.com/repos/eapache/go-resiliency/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/eapache/go-resiliency/pulls/comments/90473008"},"html":{"href":"https://github.com/eapache/go-resiliency/pull/11#discussion_r90473008"},"pull_request":{"href":"https://api.github.com/repos/eapache/go-resiliency/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/eapache/go-resiliency/pulls/11","id":95933266,"html_url":"https://github.com/eapache/go-resiliency/pull/11","diff_url":"https://github.com/eapache/go-resiliency/pull/11.diff","patch_url":"https://github.com/eapache/go-resiliency/pull/11.patch","issue_url":"https://api.github.com/repos/eapache/go-resiliency/issues/11","number":11,"state":"open","locked":false,"title":"added leaky bucket rate limiter","user":{"login":"smaxwellstewart","id":4520386,"avatar_url":"https://avatars.githubusercontent.com/u/4520386?v=3","gravatar_id":"","url":"https://api.github.com/users/smaxwellstewart","html_url":"https://github.com/smaxwellstewart","followers_url":"https://api.github.com/users/smaxwellstewart/followers","following_url":"https://api.github.com/users/smaxwellstewart/following{/other_user}","gists_url":"https://api.github.com/users/smaxwellstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/smaxwellstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaxwellstewart/subscriptions","organizations_url":"https://api.github.com/users/smaxwellstewart/orgs","repos_url":"https://api.github.com/users/smaxwellstewart/repos","events_url":"https://api.github.com/users/smaxwellstewart/events{/privacy}","received_events_url":"https://api.github.com/users/smaxwellstewart/received_events","type":"User","site_admin":false},"body":"First off thanks for the awesome project. Really love your clean style.\r\n\r\nI needed a leaky bucket rate limiter to add to a client i was building and thought that this might be useful to this repo.\r\n\r\nThis isn't the final commit as we need to add README to package, just wanting to see if this is something you are interested in?","created_at":"2016-11-30T17:07:50Z","updated_at":"2016-12-01T15:45:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b181ff4851e972e8b759bee48dddc0655d8b6ae","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/eapache/go-resiliency/pulls/11/commits","review_comments_url":"https://api.github.com/repos/eapache/go-resiliency/pulls/11/comments","review_comment_url":"https://api.github.com/repos/eapache/go-resiliency/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eapache/go-resiliency/issues/11/comments","statuses_url":"https://api.github.com/repos/eapache/go-resiliency/statuses/036ede9cdc70ec4e041c9da3eed4d475d57de492","head":{"label":"smaxwellstewart:master","ref":"master","sha":"036ede9cdc70ec4e041c9da3eed4d475d57de492","user":{"login":"smaxwellstewart","id":4520386,"avatar_url":"https://avatars.githubusercontent.com/u/4520386?v=3","gravatar_id":"","url":"https://api.github.com/users/smaxwellstewart","html_url":"https://github.com/smaxwellstewart","followers_url":"https://api.github.com/users/smaxwellstewart/followers","following_url":"https://api.github.com/users/smaxwellstewart/following{/other_user}","gists_url":"https://api.github.com/users/smaxwellstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/smaxwellstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaxwellstewart/subscriptions","organizations_url":"https://api.github.com/users/smaxwellstewart/orgs","repos_url":"https://api.github.com/users/smaxwellstewart/repos","events_url":"https://api.github.com/users/smaxwellstewart/events{/privacy}","received_events_url":"https://api.github.com/users/smaxwellstewart/received_events","type":"User","site_admin":false},"repo":{"id":75033897,"name":"go-resiliency","full_name":"smaxwellstewart/go-resiliency","owner":{"login":"smaxwellstewart","id":4520386,"avatar_url":"https://avatars.githubusercontent.com/u/4520386?v=3","gravatar_id":"","url":"https://api.github.com/users/smaxwellstewart","html_url":"https://github.com/smaxwellstewart","followers_url":"https://api.github.com/users/smaxwellstewart/followers","following_url":"https://api.github.com/users/smaxwellstewart/following{/other_user}","gists_url":"https://api.github.com/users/smaxwellstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/smaxwellstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smaxwellstewart/subscriptions","organizations_url":"https://api.github.com/users/smaxwellstewart/orgs","repos_url":"https://api.github.com/users/smaxwellstewart/repos","events_url":"https://api.github.com/users/smaxwellstewart/events{/privacy}","received_events_url":"https://api.github.com/users/smaxwellstewart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/smaxwellstewart/go-resiliency","description":"Resiliency patterns for golang","fork":true,"url":"https://api.github.com/repos/smaxwellstewart/go-resiliency","forks_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/forks","keys_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/teams","hooks_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/hooks","issue_events_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/issues/events{/number}","events_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/events","assignees_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/assignees{/user}","branches_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/branches{/branch}","tags_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/tags","blobs_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/git/refs{/sha}","trees_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/statuses/{sha}","languages_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/languages","stargazers_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/stargazers","contributors_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/contributors","subscribers_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/subscribers","subscription_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/subscription","commits_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/commits{/sha}","git_commits_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/git/commits{/sha}","comments_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/comments{/number}","issue_comment_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/issues/comments{/number}","contents_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/contents/{+path}","compare_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/merges","archive_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/downloads","issues_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/issues{/number}","pulls_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/pulls{/number}","milestones_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/milestones{/number}","notifications_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/labels{/name}","releases_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/releases{/id}","deployments_url":"https://api.github.com/repos/smaxwellstewart/go-resiliency/deployments","created_at":"2016-11-29T02:18:50Z","updated_at":"2016-11-29T02:18:51Z","pushed_at":"2016-11-30T23:32:10Z","git_url":"git://github.com/smaxwellstewart/go-resiliency.git","ssh_url":"git@github.com:smaxwellstewart/go-resiliency.git","clone_url":"https://github.com/smaxwellstewart/go-resiliency.git","svn_url":"https://github.com/smaxwellstewart/go-resiliency","homepage":"https://godoc.org/github.com/eapache/go-resiliency","size":36,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"eapache:master","ref":"master","sha":"b86b1ec0dd4209a588dc1285cdd471e73525c0b3","user":{"login":"eapache","id":1706826,"avatar_url":"https://avatars.githubusercontent.com/u/1706826?v=3","gravatar_id":"","url":"https://api.github.com/users/eapache","html_url":"https://github.com/eapache","followers_url":"https://api.github.com/users/eapache/followers","following_url":"https://api.github.com/users/eapache/following{/other_user}","gists_url":"https://api.github.com/users/eapache/gists{/gist_id}","starred_url":"https://api.github.com/users/eapache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eapache/subscriptions","organizations_url":"https://api.github.com/users/eapache/orgs","repos_url":"https://api.github.com/users/eapache/repos","events_url":"https://api.github.com/users/eapache/events{/privacy}","received_events_url":"https://api.github.com/users/eapache/received_events","type":"User","site_admin":false},"repo":{"id":27290924,"name":"go-resiliency","full_name":"eapache/go-resiliency","owner":{"login":"eapache","id":1706826,"avatar_url":"https://avatars.githubusercontent.com/u/1706826?v=3","gravatar_id":"","url":"https://api.github.com/users/eapache","html_url":"https://github.com/eapache","followers_url":"https://api.github.com/users/eapache/followers","following_url":"https://api.github.com/users/eapache/following{/other_user}","gists_url":"https://api.github.com/users/eapache/gists{/gist_id}","starred_url":"https://api.github.com/users/eapache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eapache/subscriptions","organizations_url":"https://api.github.com/users/eapache/orgs","repos_url":"https://api.github.com/users/eapache/repos","events_url":"https://api.github.com/users/eapache/events{/privacy}","received_events_url":"https://api.github.com/users/eapache/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eapache/go-resiliency","description":"Resiliency patterns for golang","fork":false,"url":"https://api.github.com/repos/eapache/go-resiliency","forks_url":"https://api.github.com/repos/eapache/go-resiliency/forks","keys_url":"https://api.github.com/repos/eapache/go-resiliency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eapache/go-resiliency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eapache/go-resiliency/teams","hooks_url":"https://api.github.com/repos/eapache/go-resiliency/hooks","issue_events_url":"https://api.github.com/repos/eapache/go-resiliency/issues/events{/number}","events_url":"https://api.github.com/repos/eapache/go-resiliency/events","assignees_url":"https://api.github.com/repos/eapache/go-resiliency/assignees{/user}","branches_url":"https://api.github.com/repos/eapache/go-resiliency/branches{/branch}","tags_url":"https://api.github.com/repos/eapache/go-resiliency/tags","blobs_url":"https://api.github.com/repos/eapache/go-resiliency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eapache/go-resiliency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eapache/go-resiliency/git/refs{/sha}","trees_url":"https://api.github.com/repos/eapache/go-resiliency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eapache/go-resiliency/statuses/{sha}","languages_url":"https://api.github.com/repos/eapache/go-resiliency/languages","stargazers_url":"https://api.github.com/repos/eapache/go-resiliency/stargazers","contributors_url":"https://api.github.com/repos/eapache/go-resiliency/contributors","subscribers_url":"https://api.github.com/repos/eapache/go-resiliency/subscribers","subscription_url":"https://api.github.com/repos/eapache/go-resiliency/subscription","commits_url":"https://api.github.com/repos/eapache/go-resiliency/commits{/sha}","git_commits_url":"https://api.github.com/repos/eapache/go-resiliency/git/commits{/sha}","comments_url":"https://api.github.com/repos/eapache/go-resiliency/comments{/number}","issue_comment_url":"https://api.github.com/repos/eapache/go-resiliency/issues/comments{/number}","contents_url":"https://api.github.com/repos/eapache/go-resiliency/contents/{+path}","compare_url":"https://api.github.com/repos/eapache/go-resiliency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eapache/go-resiliency/merges","archive_url":"https://api.github.com/repos/eapache/go-resiliency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eapache/go-resiliency/downloads","issues_url":"https://api.github.com/repos/eapache/go-resiliency/issues{/number}","pulls_url":"https://api.github.com/repos/eapache/go-resiliency/pulls{/number}","milestones_url":"https://api.github.com/repos/eapache/go-resiliency/milestones{/number}","notifications_url":"https://api.github.com/repos/eapache/go-resiliency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eapache/go-resiliency/labels{/name}","releases_url":"https://api.github.com/repos/eapache/go-resiliency/releases{/id}","deployments_url":"https://api.github.com/repos/eapache/go-resiliency/deployments","created_at":"2014-11-29T04:11:32Z","updated_at":"2016-12-01T06:38:42Z","pushed_at":"2016-11-30T23:32:10Z","git_url":"git://github.com/eapache/go-resiliency.git","ssh_url":"git@github.com:eapache/go-resiliency.git","clone_url":"https://github.com/eapache/go-resiliency.git","svn_url":"https://github.com/eapache/go-resiliency","homepage":"https://godoc.org/github.com/eapache/go-resiliency","size":30,"stargazers_count":417,"watchers_count":417,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":1,"forks":28,"open_issues":1,"watchers":417,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eapache/go-resiliency/pulls/11"},"html":{"href":"https://github.com/eapache/go-resiliency/pull/11"},"issue":{"href":"https://api.github.com/repos/eapache/go-resiliency/issues/11"},"comments":{"href":"https://api.github.com/repos/eapache/go-resiliency/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/eapache/go-resiliency/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/eapache/go-resiliency/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eapache/go-resiliency/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/eapache/go-resiliency/statuses/036ede9cdc70ec4e041c9da3eed4d475d57de492"}}}}
{"actor":{"display_login":"eapache"}}