[FIX] share: reduce risk of slowdowns during res.groups changes
Databases with thousands of users would experience poor performance during any change to a group during an update/install, caused by the prefetching of all database users when the browse cache contains most of the groups in the system.
This commit is contained in:
parent
ef53a831c6
commit
a09dadd253
|
@ -33,7 +33,10 @@ class res_users(osv.osv):
|
||||||
|
|
||||||
def _get_users_from_group(self, cr, uid, ids, context=None):
|
def _get_users_from_group(self, cr, uid, ids, context=None):
|
||||||
result = set()
|
result = set()
|
||||||
for group in self.pool['res.groups'].browse(cr, uid, ids, context=context):
|
groups = self.pool['res.groups'].browse(cr, uid, ids, context=context)
|
||||||
|
# Clear cache to avoid perf degradation on databases with thousands of users
|
||||||
|
groups.invalidate_cache()
|
||||||
|
for group in groups:
|
||||||
result.update(user.id for user in group.users)
|
result.update(user.id for user in group.users)
|
||||||
return list(result)
|
return list(result)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue