tasks: fix progress percents

mostly rebalancing the percents
This commit is contained in:
Girish Ramakrishnan
2026-03-04 16:37:30 +05:30
parent 764d479d7f
commit 7c6a783fc8
8 changed files with 46 additions and 33 deletions
+12 -12
View File
@@ -270,12 +270,12 @@ async function startCommand(app, args, progressCallback) {
await services.startAppServices(app);
if (app.manifest.id !== constants.PROXY_APP_APPSTORE_ID) {
await progressCallback({ percent: 35, message: 'Starting container' });
await progressCallback({ percent: 40, message: 'Starting container' });
await docker.startContainer(app.id);
}
// stopped apps do not renew certs. currently, we don't do DNS to not overwrite existing user settings
await progressCallback({ percent: 80, message: 'Configuring reverse proxy' });
await progressCallback({ percent: 70, message: 'Configuring reverse proxy' });
await reverseProxy.configureApp(app, AuditSource.APPTASK);
await progressCallback({ percent: 100, message: 'Done' });
@@ -308,12 +308,12 @@ async function restartCommand(app, args, progressCallback) {
await progressCallback({ percent: 10, message: 'Starting app services' });
await services.startAppServices(app);
await progressCallback({ percent: 20, message: 'Restarting container' });
await progressCallback({ percent: 30, message: 'Restarting container' });
await docker.restartContainer(app.id);
}
// stopped apps do not renew certs. currently, we don't do DNS to not overwrite existing user settings
await progressCallback({ percent: 80, message: 'Configuring reverse proxy' });
await progressCallback({ percent: 70, message: 'Configuring reverse proxy' });
await reverseProxy.configureApp(app, AuditSource.APPTASK);
await progressCallback({ percent: 100, message: 'Done' });
@@ -425,22 +425,22 @@ async function installCommand(app, args, progressCallback) {
// allocating container ip here, lets the users "repair" an app if allocation fails at apps.add time
await allocateContainerIp(app);
await progressCallback({ percent: 20, message: 'Downloading icon' });
await progressCallback({ percent: 15, message: 'Downloading icon' });
await downloadIcon(app);
await progressCallback({ percent: 25, message: 'Updating checklist' });
await progressCallback({ percent: 18, message: 'Updating checklist' });
await updateChecklist(app, app.manifest.checklist || {}, restoreConfig ? true : false);
if (!skipDnsSetup) {
await progressCallback({ percent: 30, message: 'Registering subdomains' });
await progressCallback({ percent: 20, message: 'Registering subdomains' });
await dns.registerLocations([ { subdomain: app.subdomain, domain: app.domain }].concat(app.secondaryDomains).concat(app.redirectDomains).concat(app.aliasDomains), { overwriteDns }, progressCallback);
}
await progressCallback({ percent: 40, message: 'Downloading image' });
await progressCallback({ percent: 30, message: 'Downloading image' });
await downloadImage(app.manifest);
await progressCallback({ percent: 50, message: 'Creating app data directory' });
await progressCallback({ percent: 55, message: 'Setting up app' });
await createAppDir(app);
if (!restoreConfig) { // install
@@ -515,7 +515,7 @@ async function recreateCommand(app, args, progressCallback) {
await progressCallback({ percent: 10, message: 'Deleting old container' });
await deleteContainers(app, { managedOnly: true });
await progressCallback({ percent: 60, message: 'Creating container' });
await progressCallback({ percent: 50, message: 'Creating container' });
await createContainer(app);
await startApp(app);
@@ -699,14 +699,14 @@ async function updateCommand(app, args, progressCallback) {
await verifyManifest(updateConfig.manifest);
if (!updateConfig.skipBackup) {
await progressCallback({ percent: 15, message: 'Backing up app' });
await progressCallback({ percent: 10, message: 'Backing up app' });
const sites = await backupSites.listByContentForUpdates(app.id);
if (sites.length === 0) throw new BoxError(BoxError.BAD_STATE, 'App has no backup site for updates', { backupError: true });
for (const site of sites) {
// preserve update backups for 3 weeks
const [error] = await safe(backuptask.backupApp(app, site, { preserveSecs: 3*7*24*60*60 }, (progress) => {
progressCallback({ percent: 15, message: `Backup - ${progress.message}` });
progressCallback({ percent: Math.round(10 + (progress.percent || 0) * 10 / 100), message: `Backup - ${progress.message}` });
}));
if (error) {
error.backupError = true;