Skip to content

Commit 55347ff

Browse files
committed
ref: Minor output improvements
1 parent 0fcef08 commit 55347ff

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

src/commands/publish.ts

+22-18
Original file line numberDiff line numberDiff line change
@@ -205,26 +205,26 @@ async function getRevisionInformation(
205205
return revisionInfo;
206206
} catch (e) {
207207
const errorMessage: string = e.message || '';
208-
209-
if (errorMessage.match(/404 not found|resource not found/i)) {
210-
if (secondsPassed > ZEUS_REVISION_INFO_POLLING_MAX) {
211-
throw new Error(
212-
`Waited for more than ${ZEUS_REVISION_INFO_POLLING_MAX} seconds, and the revision is still not available. Aborting.`
213-
);
208+
if (!errorMessage.match(/404 not found|resource not found/i)) {
209+
if (spinner.isSpinning) {
210+
spinner.fail();
214211
}
215-
216-
// Update the spinner
217-
const timeString = new Date().toLocaleString();
218-
const waitMessage = `[${timeString}] Revision ${revision} is not yet found in Zeus, retrying in ${ZEUS_POLLING_INTERVAL} seconds...`;
219-
spinner.text = waitMessage;
220-
spinner.start();
221-
await sleepAsync(ZEUS_POLLING_INTERVAL * 1000);
222-
secondsPassed += ZEUS_POLLING_INTERVAL;
223-
} else {
224212
throw e;
225213
}
226-
} finally {
227-
spinner.stop();
214+
215+
if (secondsPassed > ZEUS_REVISION_INFO_POLLING_MAX) {
216+
throw new Error(
217+
`Waited for more than ${ZEUS_REVISION_INFO_POLLING_MAX} seconds, and the revision is still not available. Aborting.`
218+
);
219+
}
220+
221+
// Update the spinner
222+
const timeString = new Date().toLocaleString();
223+
const waitMessage = `[${timeString}] Revision ${revision} is not yet found in Zeus, retrying in ${ZEUS_POLLING_INTERVAL} seconds...`;
224+
spinner.text = waitMessage;
225+
spinner.start();
226+
await sleepAsync(ZEUS_POLLING_INTERVAL * 1000);
227+
secondsPassed += ZEUS_POLLING_INTERVAL;
228228
}
229229
}
230230
}
@@ -246,12 +246,16 @@ async function waitForTheBuildToSucceed(
246246
// Status spinner
247247
const spinner = ora({ spinner: 'bouncingBar' }) as any;
248248
let secondsPassed = 0;
249-
249+
let firstIteration = true;
250250
while (true) {
251251
const revisionInfo: RevisionInfo = await getRevisionInformation(
252252
zeus,
253253
revision
254254
);
255+
if (firstIteration) {
256+
logger.info(`Revision ${revision} has been found in Zeus.`);
257+
firstIteration = false;
258+
}
255259

256260
const isSuccess = zeus.isRevisionBuiltSuccessfully(revisionInfo);
257261
const isFailure = zeus.isRevisionFailed(revisionInfo);

0 commit comments

Comments
 (0)