{"action":"created","issue":{"url":"https://api.github.com/repos/sopel-irc/sopel/issues/908","labels_url":"https://api.github.com/repos/sopel-irc/sopel/issues/908/labels{/name}","comments_url":"https://api.github.com/repos/sopel-irc/sopel/issues/908/comments","events_url":"https://api.github.com/repos/sopel-irc/sopel/issues/908/events","html_url":"https://github.com/sopel-irc/sopel/pull/908","id":109718132,"number":908,"title":"make message rate configurable, including burst mode","user":{"login":"larsks","id":82622,"avatar_url":"https://avatars.githubusercontent.com/u/82622?v=3","gravatar_id":"","url":"https://api.github.com/users/larsks","html_url":"https://github.com/larsks","followers_url":"https://api.github.com/users/larsks/followers","following_url":"https://api.github.com/users/larsks/following{/other_user}","gists_url":"https://api.github.com/users/larsks/gists{/gist_id}","starred_url":"https://api.github.com/users/larsks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsks/subscriptions","organizations_url":"https://api.github.com/users/larsks/orgs","repos_url":"https://api.github.com/users/larsks/repos","events_url":"https://api.github.com/users/larsks/events{/privacy}","received_events_url":"https://api.github.com/users/larsks/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-05T01:37:48Z","updated_at":"2015-10-14T18:34:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sopel-irc/sopel/pulls/908","html_url":"https://github.com/sopel-irc/sopel/pull/908","diff_url":"https://github.com/sopel-irc/sopel/pull/908.diff","patch_url":"https://github.com/sopel-irc/sopel/pull/908.patch"},"body":"This adds several knobs that control how fast Sopel will send multiple\r\nmessages to the same recipient:\r\n\r\n- `bucket_burst_tokens` -- this controls how many messages may be sent\r\n  in \"burst mode\", i.e., without any inter-message delay.\r\n- `bucket_refill_rate` -- once exhausted, burst tokens are refilled at a\r\n  rate of `bucket_refill_rate` tokens/second.\r\n- `bucket_empty_wait` -- how long to wait between sending messages when\r\n  not in burst mode.\r\n\r\nThis permits a bot to return a few lines of information quickly, while\r\nstill engaging rate limiting to prevent flood protection from kicking\r\nin.\r\n\r\nHow it works:\r\n\r\nWhen sending to a new recipient, we initialize a token counter to\r\n`bucket_burst_tokens`.  Every time we send a message, we decrement this\r\nby 1.  If the token counter reaches 0, we engage the rate limiting\r\nbehavior (which is identical to the existing code, except that the\r\nminimum wait of 0.7 seconds is now configurable).\r\n\r\nWhen sending a new message to an existing recipient, we check if the\r\ntoken counter is exhausted.  If it is, we refill it based on the elapsed\r\ntime since the last message and the value of `bucket_refill_rate`, and\r\nthen proceed as described above."},"comment":{"url":"https://api.github.com/repos/sopel-irc/sopel/issues/comments/148147963","html_url":"https://github.com/sopel-irc/sopel/pull/908#issuecomment-148147963","issue_url":"https://api.github.com/repos/sopel-irc/sopel/issues/908","id":148147963,"user":{"login":"maxpowa","id":1764978,"avatar_url":"https://avatars.githubusercontent.com/u/1764978?v=3","gravatar_id":"","url":"https://api.github.com/users/maxpowa","html_url":"https://github.com/maxpowa","followers_url":"https://api.github.com/users/maxpowa/followers","following_url":"https://api.github.com/users/maxpowa/following{/other_user}","gists_url":"https://api.github.com/users/maxpowa/gists{/gist_id}","starred_url":"https://api.github.com/users/maxpowa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxpowa/subscriptions","organizations_url":"https://api.github.com/users/maxpowa/orgs","repos_url":"https://api.github.com/users/maxpowa/repos","events_url":"https://api.github.com/users/maxpowa/events{/privacy}","received_events_url":"https://api.github.com/users/maxpowa/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T18:34:14Z","updated_at":"2015-10-14T18:34:14Z","body":"Using this change on my test bot -- works very well, have yet to encounter any issues."}}