diff options
author | Renato Botelho <renato@netgate.com> | 2017-02-10 14:10:05 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-10 14:11:25 -0200 |
commit | 7790e0dfaee5f4f1707a8bb6c6e8abf03b2001c2 (patch) | |
tree | ff0da20640b9c1209bff9c3bc4f64d2c8ae1d50e /src | |
parent | c674ae38fc09b06d4392722d0b927913368f37b3 (diff) | |
download | pfsense-7790e0dfaee5f4f1707a8bb6c6e8abf03b2001c2.zip pfsense-7790e0dfaee5f4f1707a8bb6c6e8abf03b2001c2.tar.gz |
Fix #7157
trafficgraph: Don't update the on screen visual graph while invisible,
which avoids creating a large queue of pending timer objects waiting
for the next requestAnimationFrame to happen.
Submitted by: PiBa-NL at https://github.com/pfsense/pfsense/pull/3450
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/js/traffic-graphs.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/usr/local/www/js/traffic-graphs.js b/src/usr/local/www/js/traffic-graphs.js index 0dd7b67..79e3927 100644 --- a/src/usr/local/www/js/traffic-graphs.js +++ b/src/usr/local/www/js/traffic-graphs.js @@ -90,7 +90,6 @@ function draw_graph(refreshInterval, then, backgroundupdate) { charts[value].interactiveLayer.tooltip.contentGenerator(function(data) { var units = 'b/s'; - console.log(localStorage.getItem('size')); if(localStorage.getItem('size') === "1") { units = 'B/s' } @@ -197,7 +196,15 @@ function draw_graph(refreshInterval, then, backgroundupdate) { myData[key][0].values.shift(); myData[key][1].values.shift(); - charts[key].update(); + if (!Visibility.hidden()) { + /* + * don't draw graph when tab is not + * visible. This also prevents lots of + * timers stacking up waiting for a + * frame update. + */ + charts[key].update(); + } }); |