summary refs log tree commit diff
path: root/synapse/metrics/background_process_metrics.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2018-10-03 14:14:38 +0100
committerGitHub <noreply@github.com>2018-10-03 14:14:38 +0100
commit81e2813948d3b795b5cdca816166500452bf0f99 (patch)
tree47a0f0c5458f2960f00fb61a29714a967fc7dee1 /synapse/metrics/background_process_metrics.py
parentMerge pull request #3997 from matrix-org/erikj/fix_profile_error_handling (diff)
parentNewsfile (diff)
downloadsynapse-81e2813948d3b795b5cdca816166500452bf0f99.tar.xz
Merge pull request #3996 from matrix-org/erikj/fix_bg_iteration
Fix exception in background metrics collection
Diffstat (limited to 'synapse/metrics/background_process_metrics.py')
-rw-r--r--synapse/metrics/background_process_metrics.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/metrics/background_process_metrics.py b/synapse/metrics/background_process_metrics.py
index 173908299c..037f1c490e 100644
--- a/synapse/metrics/background_process_metrics.py
+++ b/synapse/metrics/background_process_metrics.py
@@ -101,9 +101,13 @@ class _Collector(object):
             labels=["name"],
         )
 
-        # We copy the dict so that it doesn't change from underneath us
+        # We copy the dict so that it doesn't change from underneath us.
+        # We also copy the process lists as that can also change
         with _bg_metrics_lock:
-            _background_processes_copy = dict(_background_processes)
+            _background_processes_copy = {
+                k: list(v)
+                for k, v in six.iteritems(_background_processes)
+            }
 
         for desc, processes in six.iteritems(_background_processes_copy):
             background_process_in_flight_count.add_metric(