diff --git a/src/system.js b/src/system.js index aedf2a20f..c088f240b 100644 --- a/src/system.js +++ b/src/system.js @@ -240,18 +240,16 @@ class FilesystemUsageTask extends AsyncTask { this.emitData({ speed: -1 }); } - const dockerDf = await docker.df({ abortSignal }); - let usage = 0; + let usage = 0, dockerDf; for (const content of contents) { percent += (90/contents.length+1); if (abortSignal.aborted) return; this.emitProgress(percent,`Checking du of ${content.id} ${content.path}`); - if (content.id === 'docker') { - content.usage = dockerDf.LayersSize; - } else if (content.id === 'docker-volumes') { - content.usage = dockerDf.Volumes.map((v) => v.UsageData.Size).reduce((a,b) => a + b, 0); + if (content.id === 'docker' || content.id === 'docker-volumes') { + if (!dockerDf) dockerDf = await docker.df({ abortSignal }); + content.usage = content.id === 'docker' ? dockerDf.LayersSize : dockerDf.Volumes.map((v) => v.UsageData.Size).reduce((a,b) => a + b, 0); } else { const [error, usage] = await safe(du(content.path, { abortSignal })); if (error) debug(`du error ${content.path}: ${error.message}`); // can happen if app is installing etc @@ -261,7 +259,7 @@ class FilesystemUsageTask extends AsyncTask { this.emitData({ content }); } - if (mountpoint === '/') this.emitData({ type: 'standard', id: 'other', usage: used-usage }); + if (mountpoint === '/') this.emitData({ type: 'standard', id: 'os', usage: used-usage }); } }