From a198382c0634abb3b3edc96e9fd7cbd91a6fcbc9 Mon Sep 17 00:00:00 2001 From: Kevan Ahlquist Date: Sat, 23 Jan 2016 16:39:31 -0600 Subject: [PATCH] Bump stats endpoint timeout to 5 seconds, retry on error. --- app/components/stats/statsController.js | 7 ++----- app/shared/services.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/components/stats/statsController.js b/app/components/stats/statsController.js index 38fb08de6..b1d90b22e 100644 --- a/app/components/stats/statsController.js +++ b/app/components/stats/statsController.js @@ -110,9 +110,10 @@ angular.module('stats', []) updateCpuChart(d); updateMemoryChart(d); updateNetworkChart(d); - timeout = $timeout(updateStats, 2000); + timeout = $timeout(updateStats, 5000); }, function () { Messages.error('Unable to retrieve stats', 'Is this container running?'); + timeout = $timeout(updateStats, 5000); }); } @@ -124,13 +125,11 @@ angular.module('stats', []) updateStats(); function updateCpuChart(data) { - console.log('updateCpuChart', data); cpuChart.addData([calculateCPUPercent(data)], new Date(data.read).toLocaleTimeString()); cpuChart.removeData(); } function updateMemoryChart(data) { - console.log('updateMemoryChart', data); memoryChart.addData([data.memory_stats.usage], new Date(data.read).toLocaleTimeString()); memoryChart.removeData(); } @@ -152,7 +151,6 @@ angular.module('stats', []) } lastRxBytes = data.network.rx_bytes; lastTxBytes = data.network.tx_bytes; - console.log('updateNetworkChart', data); networkChart.addData([rxBytes, txBytes], new Date(data.read).toLocaleTimeString()); networkChart.removeData(); } @@ -170,7 +168,6 @@ angular.module('stats', []) var systemDelta = curCpu.system_cpu_usage - prevCpu.system_cpu_usage; if (systemDelta > 0.0 && cpuDelta > 0.0) { - //console.log('size thing:', curCpu.cpu_usage.percpu_usage); cpuPercent = (cpuDelta / systemDelta) * curCpu.cpu_usage.percpu_usage.length * 100.0; } return cpuPercent; diff --git a/app/shared/services.js b/app/shared/services.js index f2b9da742..2f9530d73 100644 --- a/app/shared/services.js +++ b/app/shared/services.js @@ -18,7 +18,7 @@ angular.module('dockerui.services', ['ngResource']) create: {method: 'POST', params: {action: 'create'}}, remove: {method: 'DELETE', params: {id: '@id', v: 0}}, rename: {method: 'POST', params: {id: '@id', action: 'rename'}, isArray: false}, - stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 2000} + stats: {method: 'GET', params: {id: '@id', stream: false, action: 'stats'}, timeout: 5000} }); }]) .factory('ContainerCommit', ['$resource', '$http', 'Settings', function ContainerCommitFactory($resource, $http, Settings) {