0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-19 08:24:25 +01:00

Don't explode if we have no snapshots yet

This commit is contained in:
Erik Johnston 2016-07-20 16:59:52 +01:00
parent 742056be0d
commit d36b1d849d

View file

@ -180,6 +180,9 @@ class MemoryUsageMetric(object):
self.memory_snapshots[:] = self.memory_snapshots[-max_size:] self.memory_snapshots[:] = self.memory_snapshots[-max_size:]
def render(self): def render(self):
if not self.memory_snapshots:
return []
max_rss = max(self.memory_snapshots) max_rss = max(self.memory_snapshots)
min_rss = min(self.memory_snapshots) min_rss = min(self.memory_snapshots)
sum_rss = sum(self.memory_snapshots) sum_rss = sum(self.memory_snapshots)