Skip to content

Commit

Permalink
[core] Make sure callables without rate limit will never get rate lim…
Browse files Browse the repository at this point in the history
…ited

Fixes #239
If func.rate is zero or None (as None > 0 == False), don't bother going into
the rate limiting code. This prevents the race condition described by @Venti-
in issue #239
  • Loading branch information
Elad Alfassa committed Apr 29, 2014
1 parent bb70fa6 commit 736b7b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions willie/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ def call(self, func, origin, willie, trigger):

if not trigger.admin and \
not func.unblockable and \
func.rate > 0 and \
func in self.times[nick]:
timediff = time.time() - self.times[nick][func]
if timediff < func.rate:
Expand Down

1 comment on commit 736b7b6

@elad661
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, actual issue is #293, not #239

Please sign in to comment.