Giter Site home page Giter Site logo

Ratelimit notices about irc HOT 5 CLOSED

jaraco avatar jaraco commented on May 28, 2024
Ratelimit notices

from irc.

Comments (5)

jaraco avatar jaraco commented on May 28, 2024

I've put together a draft implementation that would allow one to set a rate limit on a connection in 95d201adc509. One would simply call connection.set_rate_limit with a number (messages per second), and it would install a throttler on the send_raw method.

Let me know what you think, and if that interface would be suitable.


Original comment by: Jason R. Coombs

from irc.

jaraco avatar jaraco commented on May 28, 2024

When trying to run it, hit a few snags - not sure if it's me. (not a python guy yet).

client.py - line 967 : should it be .count() not .Count()
client.py - line 971 : self.start isn't a function (I think)

Finally, what I can't figure out is this traceback:

File "./libs/irc/bot.py", line 259, in start
self._connect()
File "./libs/irc/bot.py", line 115, in _connect
*_self.__connect_params)
File "./libs/irc/client.py", line 1173, in connect
self.connection.connect(_args, *_kwargs)
File "./libs/irc/functools.py", line 37, in wrapper
return method(self, *args, *_kwargs)
File "./libs/irc/client.py", line 494, in connect
self.nick(self.nickname)
File "./libs/irc/client.py", line 816, in nick
self.send_raw("NICK " + newnick)
File "./libs/irc/client.py", line 974, in call
return self.func()
TypeError: send_raw() takes exactly 2 arguments (1 given)


Original comment by: Jason Kendall

from irc.

jaraco avatar jaraco commented on May 28, 2024

Thanks for the help in troubleshooting and for the pull request. I've accepted the pull request and taken the opportunity to also add a couple of tests to exercise the Throttler class (something I would normally have done early).

I've released 8.2 with this feature. Please let me know if you encounter any other issues.


Original comment by: Jason R. Coombs

from irc.

jaraco avatar jaraco commented on May 28, 2024

Fixed and released in 8.2


Original comment by: Jason R. Coombs

from irc.

jaraco avatar jaraco commented on May 28, 2024

Thanks Jason. No way I would have thought of that method. Good learning for me as well.


Original comment by: Jason Kendall

from irc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.