{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/comments/208849924","pull_request_review_id":144742845,"id":208849924,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODg0OTkyNA==","diff_hunk":"@@ -12,50 +13,51 @@\n \n     private static final Logger LOGGER = LoggerFactory.getLogger(RateLimiter.class);\n \n-    private final int rate;\n-    private final int rateForPost;\n+    private int rate;\n+    private int rateForPost;\n+    private int auditRate;\n+    private int perMillis;\n+    private int noOfNodes;\n     \n     private static final String METHOD_POST = \"POST\";\n     \n-    private final int auditRate;\n-    private final int perMillis;\n-    private final Cache<String, RateLimit> cache;\n     private final Cache<String, RateLimit> auditCache;\n-\n-    public RateLimiter(int rate, int rateForPost, int auditRate, int perMillis) {\n+    LocalRateLimiter localRateLimiter;\n+    RedisRateLimiter redisRateLimiter;","path":"src/main/java/uk/gov/pay/api/filter/ratelimit/RateLimiter.java","position":null,"original_position":31,"commit_id":"68d57d733430384939f5f849a6d97c03ae5ccf14","original_commit_id":"d01e911d75aee1c9bdf412d61daf239c1db883d3","user":{"login":"kbottla","id":40598480,"node_id":"MDQ6VXNlcjQwNTk4NDgw","avatar_url":"https://avatars3.githubusercontent.com/u/40598480?v=4","gravatar_id":"","url":"https://api.github.com/users/kbottla","html_url":"https://github.com/kbottla","followers_url":"https://api.github.com/users/kbottla/followers","following_url":"https://api.github.com/users/kbottla/following{/other_user}","gists_url":"https://api.github.com/users/kbottla/gists{/gist_id}","starred_url":"https://api.github.com/users/kbottla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbottla/subscriptions","organizations_url":"https://api.github.com/users/kbottla/orgs","repos_url":"https://api.github.com/users/kbottla/repos","events_url":"https://api.github.com/users/kbottla/events{/privacy}","received_events_url":"https://api.github.com/users/kbottla/received_events","type":"User","site_admin":false},"body":"Changed to private..","created_at":"2018-08-09T08:43:11Z","updated_at":"2018-08-09T08:43:11Z","html_url":"https://github.com/alphagov/pay-publicapi/pull/241#discussion_r208849924","pull_request_url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/comments/208849924"},"html":{"href":"https://github.com/alphagov/pay-publicapi/pull/241#discussion_r208849924"},"pull_request":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241"}},"in_reply_to_id":208581012},"pull_request":{"url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241","id":206950576,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2OTUwNTc2","html_url":"https://github.com/alphagov/pay-publicapi/pull/241","diff_url":"https://github.com/alphagov/pay-publicapi/pull/241.diff","patch_url":"https://github.com/alphagov/pay-publicapi/pull/241.patch","issue_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues/241","number":241,"state":"open","locked":false,"title":"PP_4036 - Ratelimiting using Redis","user":{"login":"kbottla","id":40598480,"node_id":"MDQ6VXNlcjQwNTk4NDgw","avatar_url":"https://avatars3.githubusercontent.com/u/40598480?v=4","gravatar_id":"","url":"https://api.github.com/users/kbottla","html_url":"https://github.com/kbottla","followers_url":"https://api.github.com/users/kbottla/followers","following_url":"https://api.github.com/users/kbottla/following{/other_user}","gists_url":"https://api.github.com/users/kbottla/gists{/gist_id}","starred_url":"https://api.github.com/users/kbottla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbottla/subscriptions","organizations_url":"https://api.github.com/users/kbottla/orgs","repos_url":"https://api.github.com/users/kbottla/repos","events_url":"https://api.github.com/users/kbottla/events{/privacy}","received_events_url":"https://api.github.com/users/kbottla/received_events","type":"User","site_admin":false},"body":"Redis based solution to support rate limit API requests. Enhances current solution so that public api nodes can lookup redis for accurate rate limits instead of local cache. When redis is not available the solution will fall back to current solution (using local cache) and logs errors appropriately.\r\n\r\nChanges include: \r\n - Redis for RateLimiting\r\n - RateLimit test with Jedis library using Redis\r\n - Added docker-client library for Integration tests\r\n - Fixed issue with failing integration tests\r\n - Fallback to local rate limit solution when Redis is unavailable & tests","created_at":"2018-08-08T09:47:46Z","updated_at":"2018-08-09T08:43:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ead66be6363ed0b57e3c84ed1bfbf5c4d7aa105","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241/commits","review_comments_url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241/comments","review_comment_url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues/241/comments","statuses_url":"https://api.github.com/repos/alphagov/pay-publicapi/statuses/68d57d733430384939f5f849a6d97c03ae5ccf14","head":{"label":"alphagov:pp_4036_spike_redis_backed_rate_limiter","ref":"pp_4036_spike_redis_backed_rate_limiter","sha":"68d57d733430384939f5f849a6d97c03ae5ccf14","user":{"login":"alphagov","id":596977,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5Njk3Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":39890205,"node_id":"MDEwOlJlcG9zaXRvcnkzOTg5MDIwNQ==","name":"pay-publicapi","full_name":"alphagov/pay-publicapi","owner":{"login":"alphagov","id":596977,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5Njk3Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/pay-publicapi","description":"The Payments Public API in Java (Dropwizard)","fork":false,"url":"https://api.github.com/repos/alphagov/pay-publicapi","forks_url":"https://api.github.com/repos/alphagov/pay-publicapi/forks","keys_url":"https://api.github.com/repos/alphagov/pay-publicapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/pay-publicapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/pay-publicapi/teams","hooks_url":"https://api.github.com/repos/alphagov/pay-publicapi/hooks","issue_events_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/pay-publicapi/events","assignees_url":"https://api.github.com/repos/alphagov/pay-publicapi/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/pay-publicapi/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/pay-publicapi/tags","blobs_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/pay-publicapi/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/pay-publicapi/languages","stargazers_url":"https://api.github.com/repos/alphagov/pay-publicapi/stargazers","contributors_url":"https://api.github.com/repos/alphagov/pay-publicapi/contributors","subscribers_url":"https://api.github.com/repos/alphagov/pay-publicapi/subscribers","subscription_url":"https://api.github.com/repos/alphagov/pay-publicapi/subscription","commits_url":"https://api.github.com/repos/alphagov/pay-publicapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/pay-publicapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/pay-publicapi/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/pay-publicapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/pay-publicapi/merges","archive_url":"https://api.github.com/repos/alphagov/pay-publicapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/pay-publicapi/downloads","issues_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/pay-publicapi/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/pay-publicapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/pay-publicapi/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/pay-publicapi/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/pay-publicapi/deployments","created_at":"2015-07-29T11:37:37Z","updated_at":"2018-08-03T08:20:15Z","pushed_at":"2018-08-09T08:42:53Z","git_url":"git://github.com/alphagov/pay-publicapi.git","ssh_url":"git@github.com:alphagov/pay-publicapi.git","clone_url":"https://github.com/alphagov/pay-publicapi.git","svn_url":"https://github.com/alphagov/pay-publicapi","homepage":null,"size":8911,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":1,"watchers":27,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"c27bd95b7afcfd4351cb430c52859c37513d110a","user":{"login":"alphagov","id":596977,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5Njk3Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":39890205,"node_id":"MDEwOlJlcG9zaXRvcnkzOTg5MDIwNQ==","name":"pay-publicapi","full_name":"alphagov/pay-publicapi","owner":{"login":"alphagov","id":596977,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5Njk3Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/pay-publicapi","description":"The Payments Public API in Java (Dropwizard)","fork":false,"url":"https://api.github.com/repos/alphagov/pay-publicapi","forks_url":"https://api.github.com/repos/alphagov/pay-publicapi/forks","keys_url":"https://api.github.com/repos/alphagov/pay-publicapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/pay-publicapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/pay-publicapi/teams","hooks_url":"https://api.github.com/repos/alphagov/pay-publicapi/hooks","issue_events_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/pay-publicapi/events","assignees_url":"https://api.github.com/repos/alphagov/pay-publicapi/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/pay-publicapi/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/pay-publicapi/tags","blobs_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/pay-publicapi/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/pay-publicapi/languages","stargazers_url":"https://api.github.com/repos/alphagov/pay-publicapi/stargazers","contributors_url":"https://api.github.com/repos/alphagov/pay-publicapi/contributors","subscribers_url":"https://api.github.com/repos/alphagov/pay-publicapi/subscribers","subscription_url":"https://api.github.com/repos/alphagov/pay-publicapi/subscription","commits_url":"https://api.github.com/repos/alphagov/pay-publicapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/pay-publicapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/pay-publicapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/pay-publicapi/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/pay-publicapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/pay-publicapi/merges","archive_url":"https://api.github.com/repos/alphagov/pay-publicapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/pay-publicapi/downloads","issues_url":"https://api.github.com/repos/alphagov/pay-publicapi/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/pay-publicapi/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/pay-publicapi/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/pay-publicapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/pay-publicapi/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/pay-publicapi/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/pay-publicapi/deployments","created_at":"2015-07-29T11:37:37Z","updated_at":"2018-08-03T08:20:15Z","pushed_at":"2018-08-09T08:42:53Z","git_url":"git://github.com/alphagov/pay-publicapi.git","ssh_url":"git@github.com:alphagov/pay-publicapi.git","clone_url":"https://github.com/alphagov/pay-publicapi.git","svn_url":"https://github.com/alphagov/pay-publicapi","homepage":null,"size":8911,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":1,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241"},"html":{"href":"https://github.com/alphagov/pay-publicapi/pull/241"},"issue":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/issues/241"},"comments":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/issues/241/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/pulls/241/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/pay-publicapi/statuses/68d57d733430384939f5f849a6d97c03ae5ccf14"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kbottla"}}