yetibot / core

:expressionless: Core yetibot utilities, extracted for shared use among Yetibot and its various plugins
https://yetibot.com
Eclipse Public License 1.0
27 stars 17 forks source link

Throttle send-msg for IRC to prevent flooding. #111

Closed sarg closed 4 years ago

sarg commented 4 years ago

Allow 1 request per second with burstiness up to 5. Use log/warn when server reports flooding.

Seems that 1 rps is the default setting for IRC protocol. I've played with different throttling strategies on freenode using !range 20 | xargs echo and seems that current one is pretty safe.

codecov[bot] commented 4 years ago

Codecov Report

Merging #111 into master will decrease coverage by 0.03%. The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #111      +/-   ##
==========================================
- Coverage   43.76%   43.73%   -0.04%     
==========================================
  Files          90       90              
  Lines        3578     3583       +5     
  Branches      166      166              
==========================================
+ Hits         1566     1567       +1     
- Misses       1846     1850       +4     
  Partials      166      166
Impacted Files Coverage Δ
src/yetibot/core/adapters/irc.clj 24.3% <33.33%> (-0.13%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0ab9114...1dab216. Read the comment docs.

devth commented 4 years ago

@sarg this looks great! Will test it out later today.

devth commented 4 years ago

Played with this, it's awesome. I didn't find any official docs on allows rps on freenode but I think 1 rps is pretty safe, though it is a bit slow. Might be something we make configurable.

Thanks for the PR!