Commit 472a3552 authored by Philip ABBET's avatar Philip ABBET
Browse files

Fix: When statistics about a container are retrieved too soon it might fail

parent f55811ca
Pipeline #8847 passed with stage
in 8 minutes and 34 seconds
......@@ -635,6 +635,17 @@ class Popen:
data = self._stats()
# If CPU statistics can't be retrieved
if not data['cpu_stats'].has_key('system_cpu_usage'):
data['cpu_stats'] = dict(data['precpu_stats'])
# If memory statistics can't be retrieved
if len(data['memory_stats']) == 0:
data['memory_stats'] = dict(
limit=0,
max_usage=0
)
previous_cpu = self.previous_stats['cpu_stats'] \
if self.previous_stats else None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment