mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 20:59:22 -05:00
add comment about why unreg
This commit is contained in:
parent
a2eb5db4a0
commit
357c74a50f
@ -41,6 +41,8 @@ response_cache_total = Gauge("synapse_util_caches_response_cache:total", "", ["n
|
|||||||
def register_cache(cache_type, cache_name, cache):
|
def register_cache(cache_type, cache_name, cache):
|
||||||
|
|
||||||
# Check if the metric is already registered. Unregister it, if so.
|
# Check if the metric is already registered. Unregister it, if so.
|
||||||
|
# This usually happens during tests, as at runtime these caches are
|
||||||
|
# effectively singletons.
|
||||||
metric_name = "cache_%s_%s" % (cache_type, cache_name)
|
metric_name = "cache_%s_%s" % (cache_type, cache_name)
|
||||||
if metric_name in collectors_by_name.keys():
|
if metric_name in collectors_by_name.keys():
|
||||||
REGISTRY.unregister(collectors_by_name[metric_name])
|
REGISTRY.unregister(collectors_by_name[metric_name])
|
||||||
|
Loading…
Reference in New Issue
Block a user