mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added some sanity checks to cache reduction
This commit is contained in:
parent
6658165bae
commit
4c6b40e42f
@ -1179,9 +1179,10 @@ def reduce_caches(to=0.75):
|
||||
global cache_query, cache_aggregate, cache_query_perm, cache_aggregate_perm
|
||||
for c in cache_query, cache_aggregate, cache_query_perm, cache_aggregate_perm:
|
||||
currentsize = len(c)
|
||||
targetsize = int(currentsize * to)
|
||||
c.set_size(targetsize)
|
||||
c.set_size(csz)
|
||||
if currentsize > 100:
|
||||
targetsize = max(int(currentsize * to),10)
|
||||
c.set_size(targetsize)
|
||||
c.set_size(csz)
|
||||
|
||||
def reduce_caches_if_low_ram():
|
||||
ramprct = psutil.virtual_memory().percent
|
||||
|
Loading…
Reference in New Issue
Block a user