Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flood protection is not working #50

Open
davidscholberg opened this issue Nov 19, 2020 · 0 comments
Open

Flood protection is not working #50

davidscholberg opened this issue Nov 19, 2020 · 0 comments

Comments

@davidscholberg
Copy link

davidscholberg commented Nov 19, 2020

Describe the bug
I encountered a bug with this library while playing around with hubot's IRC adapter hubot-irc, which uses this library. hubot-irc allows you to configure the flood protection functionality offered by this library. However, I found that no matter what I set the flood protection delay value to, there didn't seem to be any flood protection at all. I noticed this when trying to use hubot's help command, which sends multiple messages each time it's called. These messages were not rate-limited at all; they would all get sent to the channel almost immediately. I did verify with console.log messages that hubot-irc was passing the flood protection config correctly to node-irc.

node-irc version: f222abe

To Reproduce
I don't have a super simple test for this, but it is fairly easy to spin up a hubot instance with the IRC adapter and test it that way.

Steps to reproduce the behavior:

  1. Open up a terminal on a system that has node/npm installed, and enter the following (changing server and room info as needed):
npm install -g yo generator-hubot
mkdir myhubot
cd myhubot
yo hubot --adapter=irc
HUBOT_IRC_SERVER=irc.freenode.net \
  HUBOT_IRC_ROOMS="#myhubot-irc" \
  HUBOT_IRC_NICK="myhubot" \
  HUBOT_IRC_UNFLOOD="1000" \
  bin/hubot -a irc --name myhubot
  1. Go to the channel that you configured hubot to join and type myhubot: help
  2. Observe that the messages all come in nearly at once rather than once per second.

Expected behavior
Since flood protection was configured above with a 1 second delay, you'd expect messages to come in once per second.

Screenshots
N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):
N/A

Additional context
I dug around in the flood protection code and I believe I've figured out the cause of the bug. I also have a fix for it located at davidscholberg#2. I can move that PR here if it's acceptable.

davidscholberg added a commit to davidscholberg/hubot-irc that referenced this issue Nov 19, 2020
davidscholberg added a commit to davidscholberg/chanspy that referenced this issue Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant