Show More
@@ -39,11 +39,12 b' def free_cache_keys(*args):' | |||||
39 | if cache_keys_by_pid: |
|
39 | if cache_keys_by_pid: | |
40 | try: |
|
40 | try: | |
41 | for cache_proc in cache_keys_by_pid: |
|
41 | for cache_proc in cache_keys_by_pid: | |
42 | CacheKey.query().filter(CacheKey.cache_key.startswith(cache_proc)).delete() |
|
42 | like_expression = '{}%'.format(cache_proc) | |
|
43 | CacheKey.query().filter(CacheKey.cache_key.like(like_expression)).delete() | |||
43 | cache_keys_by_pid.remove(cache_proc) |
|
44 | cache_keys_by_pid.remove(cache_proc) | |
44 | Session().commit() |
|
45 | Session().commit() | |
45 | except Exception: |
|
46 | except Exception: | |
46 |
log. |
|
47 | log.exception('Failed to clear keys, exiting gracefully') | |
47 |
|
48 | |||
48 |
|
49 | |||
49 | atexit.register(free_cache_keys) |
|
50 | atexit.register(free_cache_keys) |
General Comments 0
You need to be logged in to leave comments.
Login now