Skip to content

Commit 9415a48

Browse files
casparvljtpio
authored andcommitted
Test explicitely if cpuPercent is defined. If not, the key 'cpu_percent' 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
1 parent f0a175f commit 9415a48

File tree

1 file changed

+1
-1
lines changed
  • jupyter_resource_usage/static

1 file changed

+1
-1
lines changed

jupyter_resource_usage/static/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ define([
7474

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

0 commit comments

Comments
 (0)