diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-07-19 11:04:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 11:04:18 +0100 |
commit | c754e006f4860718057ad6dded91e66f6239bb57 (patch) | |
tree | 6101a439c55c0f6d41c8d13cf5ff985e21fd9d51 /synapse/util/caches/expiringcache.py | |
parent | Move v1-only APIs into their own module & isolate deprecated ones (#3460) (diff) | |
parent | Make Distributor run its processes as a background process (diff) | |
download | synapse-c754e006f4860718057ad6dded91e66f6239bb57.tar.xz |
Merge pull request #3556 from matrix-org/rav/background_processes
Run things as background processes
Diffstat (limited to 'synapse/util/caches/expiringcache.py')
-rw-r--r-- | synapse/util/caches/expiringcache.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/util/caches/expiringcache.py b/synapse/util/caches/expiringcache.py index 4abca91f6d..465adc54a8 100644 --- a/synapse/util/caches/expiringcache.py +++ b/synapse/util/caches/expiringcache.py @@ -16,6 +16,7 @@ import logging from collections import OrderedDict +from synapse.metrics.background_process_metrics import run_as_background_process from synapse.util.caches import register_cache logger = logging.getLogger(__name__) @@ -63,7 +64,10 @@ class ExpiringCache(object): return def f(): - self._prune_cache() + run_as_background_process( + "prune_cache_%s" % self._cache_name, + self._prune_cache, + ) self._clock.looping_call(f, self._expiry_ms / 2) |