Skip to content

Commit

Permalink
Test explicitely if cpuPercent is defined. If not, the key 'cpu_perce…
Browse files Browse the repository at this point in the history
…nt' didn't exist in the 'data'. Previously, the update would not only be skipped if the key didn't exist, but _also_ if the cpuPercent was zero, which would result in the CPU usage only being updated _during_ execution of a cell (when CPU usage is non-zero), and it would never return to zero afterwards
  • Loading branch information
casparvl authored and jtpio committed Oct 3, 2022
1 parent f0a175f commit 9415a48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jupyter_resource_usage/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ define([

// Handle CPU display
var cpuPercent = data['cpu_percent'];
if (cpuPercent) {
if (cpuPercent !== undefined) {
// Remove hide CSS class if the metrics API gives us a CPU percent to display
$('#jupyter-resource-usage-display-cpu').removeClass('jupyter-resource-usage-hide');
var maxCpu = data['cpu_count'];
Expand Down

0 comments on commit 9415a48

Please sign in to comment.