Merge pull request #3996 from matrix-org/erikj/fix_bg_iteration

Fix exception in background metrics collection
This commit is contained in:
Erik Johnston 2018-10-03 14:14:38 +01:00 committed by GitHub
commit 81e2813948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

1
changelog.d/3996.bugfix Normal file
View File

@ -0,0 +1 @@
Fix exception in background metrics collection

View File

@ -101,9 +101,13 @@ class _Collector(object):
labels=["name"], 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: 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): for desc, processes in six.iteritems(_background_processes_copy):
background_process_in_flight_count.add_metric( background_process_in_flight_count.add_metric(