Skip to content
This repository

Users queryset in clear_permission_cache function could be improved #1648

setsu opened this Issue March 07, 2013 · 5 comments

5 participants

setsu Patrick Lauber Ioan Alexandru Cucu Iacopo Spalletti Henning Sprang
setsu commented March 07, 2013

In /cms/cache/ file

def clear_permission_cache():
    users = User.objects.filter(is_active=True)

might be

def clear_permission_cache():
    users = User.objects.filter(is_active=True,

because is quite common to have few administrators and a lot of registered users.

Otherwise, please could you tell me the reason for this logic?

Ioan Alexandru Cucu
kux commented March 08, 2013

It's because of the view permissions which can be applied to regular users as well.

I agree that the query might be quite expensive... An alternative would probably be to have a dedicated permissions only cache which you completely clear (=> no db query at all)

Ioan Alexandru Cucu
kux commented March 08, 2013

You might also want to look at #1423 which is the reason why the query was added.

Iacopo Spalletti
yakky commented July 11, 2013

This should be solved by #1792

Henning Sprang

Ift it's solved, can it be closed? I found this issue by looking for "easy picking" but seems there's nothing that can be done to help here...

Patrick Lauber

I think we can close it.

Patrick Lauber digi604 closed this November 06, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.