##// END OF EJS Templates
caches: log properly how we cleanup cache keys
super-admin -
r4850:cbf6ce71 default
parent child Browse files
Show More
@@ -34,14 +34,15 b' def free_cache_keys(*args):'
34 return
34 return
35
35
36 from rhodecode.model.db import Session, CacheKey
36 from rhodecode.model.db import Session, CacheKey
37 log.info('Clearing %s cache keys', len(cache_keys_by_pid))
38
37
39 if cache_keys_by_pid:
38 if cache_keys_by_pid:
40 try:
39 try:
41 for cache_proc in set(cache_keys_by_pid):
40 for cache_proc in set(cache_keys_by_pid):
42 like_expression = '{}%'.format(cache_proc)
41 like_expression = '{}%'.format(cache_proc)
43 CacheKey.query().filter(
42 qry = CacheKey.query().filter(CacheKey.cache_key.like(like_expression))
44 CacheKey.cache_key.like(like_expression)).delete(synchronize_session='fetch')
43 count = qry.count()
44 log.info('Clearing %s: %s cache keys, total: %s', cache_proc, len(cache_keys_by_pid), count)
45 qry.delete(synchronize_session='fetch')
45 cache_keys_by_pid.remove(cache_proc)
46 cache_keys_by_pid.remove(cache_proc)
46 Session().commit()
47 Session().commit()
47 except Exception:
48 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now