diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-07-18 14:35:24 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-07-18 20:55:05 +0100 |
commit | 667fba68f3ca808f48143a2a739a54665b0162c6 (patch) | |
tree | bc180067772796f815877cfa5aefcd0a471fab9e /synapse/util/caches | |
parent | Merge pull request #3553 from matrix-org/rav/background_process_tracking (diff) | |
download | synapse-667fba68f3ca808f48143a2a739a54665b0162c6.tar.xz |
Run things as background processes
This fixes #3518, and ensures that we get useful logs and metrics for lots of things that happen in the background. (There are certainly more things that happen in the background; these are just the common ones I've found running a single-process synapse locally).
Diffstat (limited to 'synapse/util/caches')
-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) |