philipn/django-block-ip

Cache the BlockIP queryset in middleware

Closed this issue · 1 comments

Calling BlockIP.objects.all() for every process_request can send "Too Many"™ database queries. And there's an existing TODO in the code to optimize it.

(django-banish caches its Banishment queryset during middleware init, but it has a pretty serious bug with TIMEOUTs.)

So, to correctly cache BlockIP querysets, django-block-ip should cache the queryset with no timeout, and rely on model signal handlers to update and delete the cache.

@philipn - how actively are you maintaining this library? Any chance you'll be able to work on these issues?