summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-07-20 16:59:52 +0100
committerErik Johnston <erik@matrix.org>2016-07-20 16:59:52 +0100
commitd36b1d849d5d896967ab2ade7c206513e502d94f (patch)
treeb1d41b409be16a85a6717a78d9ac4cf82ede9534
parentMerge pull request #937 from matrix-org/rav/register_device_on_register (diff)
downloadsynapse-d36b1d849d5d896967ab2ade7c206513e502d94f.tar.xz
Don't explode if we have no snapshots yet
Diffstat (limited to '')
-rw-r--r--synapse/metrics/metric.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/metrics/metric.py b/synapse/metrics/metric.py
index d100841a7f..7becbe0491 100644
--- a/synapse/metrics/metric.py
+++ b/synapse/metrics/metric.py
@@ -180,6 +180,9 @@ class MemoryUsageMetric(object):
         self.memory_snapshots[:] = self.memory_snapshots[-max_size:]
 
     def render(self):
+        if not self.memory_snapshots:
+            return []
+
         max_rss = max(self.memory_snapshots)
         min_rss = min(self.memory_snapshots)
         sum_rss = sum(self.memory_snapshots)