abersheeran / asgi-ratelimit

A ASGI Middleware to rate limit
Apache License 2.0
292 stars 11 forks source link

Replaced list comprehension with generators #36

Closed mrcatspoon closed 2 years ago

mrcatspoon commented 2 years ago

Hi! I’ve made some small improvements:

  1. Replaced list comprehension with next(filter(…)). In this case we won’t iterate over every rule and really return the first rule matched
  2. Replaced list comprehension with any(). In this case any() will return True when it founds first required attribute in rule object
  3. Fixed small typo in reponse -> response
abersheeran commented 2 years ago

Include at https://github.com/abersheeran/asgi-ratelimit/pull/44