diff --git a/rhodecode/lib/rc_cache/cache_key_meta.py b/rhodecode/lib/rc_cache/cache_key_meta.py --- a/rhodecode/lib/rc_cache/cache_key_meta.py +++ b/rhodecode/lib/rc_cache/cache_key_meta.py @@ -39,11 +39,12 @@ def free_cache_keys(*args): if cache_keys_by_pid: try: for cache_proc in cache_keys_by_pid: - CacheKey.query().filter(CacheKey.cache_key.startswith(cache_proc)).delete() + like_expression = '{}%'.format(cache_proc) + CacheKey.query().filter(CacheKey.cache_key.like(like_expression)).delete() cache_keys_by_pid.remove(cache_proc) Session().commit() except Exception: - log.warn('Failed to clear keys, exiting gracefully') + log.exception('Failed to clear keys, exiting gracefully') atexit.register(free_cache_keys)