Only check once for the default backup location for metrics
This commit is contained in:
+10
-7
@@ -125,19 +125,22 @@ async function getFilesystems() {
|
||||
filesystems[diskInfo.filesystem].contents.push(stdPath);
|
||||
}
|
||||
|
||||
for (const backupSite of await backupSites.list()) {
|
||||
const sites = await backupSites.list();
|
||||
for (const backupSite of sites) {
|
||||
if (backupSite.provider === 'filesystem') {
|
||||
const [, dfResult] = await safe(df.file(backupSite.config.backupDir));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup', id: backupSite.id, path: backupSite.config.backupDir });
|
||||
}
|
||||
|
||||
// often the default backup dir is not cleaned up
|
||||
if (backupSite.provider !== 'filesystem' || backupSite.config.backupDir !== paths.DEFAULT_BACKUP_DIR) {
|
||||
const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR });
|
||||
}
|
||||
}
|
||||
|
||||
// often the default backup dir is not cleaned up
|
||||
const siteForDefault = sites.find(s => s.provider === 'filesystem' && s.config.backupDir === paths.DEFAULT_BACKUP_DIR);
|
||||
if (!siteForDefault) {
|
||||
const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR));
|
||||
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
|
||||
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR });
|
||||
}
|
||||
|
||||
const [dockerError, dockerInfo] = await safe(docker.info());
|
||||
|
||||
Reference in New Issue
Block a user