mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Fix exception in background metrics collection
We attempted to iterate through a list on a separate thread without doing the necessary copying.
This commit is contained in:
parent
25baf3b2ac
commit
7c570bff74
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user