Skip to content

Commit

Permalink
feat(agoric-cli): quieter deployment progress
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Aug 12, 2020
1 parent 6bfe9d6 commit 11b60c1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/agoric-cli/lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ export default async function deployMain(progname, rawArgs, powers, opts) {
const wsurl = `ws://${opts.hostport}/private/captp`;
const exit = makePromiseKit();
let connected = false;
let retries = 0;
process.stdout.write(`Open CapTP connection to ${wsurl}...`);
let progressDot = '.';
const progressTimer = setInterval(
() => process.stdout.write(progressDot),
1000,
);
const retryWebsocket = () => {
retries += 1;
console.info(`Open CapTP connection to ${wsurl} (try=${retries})...`);
const ws = makeWebSocket(wsurl, { origin: 'http://127.0.0.1' });
ws.on('open', async () => {
connected = true;
Expand All @@ -80,9 +83,11 @@ export default async function deployMain(progname, rawArgs, powers, opts) {
let bootP = getBootstrap();
let lastUpdateCount;
let stillLoading = [...need].sort();
progressDot = 'o';
while (stillLoading.length) {
// Wait for the notifier to report a new state.
console.warn('need:', stillLoading.join(', '));
process.stdout.write(progressDot);
console.debug('need:', stillLoading.join(', '));
const update = await E(E.G(bootP).loadingNotifier).getUpdateSince(
lastUpdateCount,
);
Expand All @@ -97,6 +102,8 @@ export default async function deployMain(progname, rawArgs, powers, opts) {
stillLoading = nextLoading;
}

clearInterval(progressTimer);
process.stdout.write('\n');
console.debug(JSON.stringify(need), 'loaded');
// Take a new copy, since the chain objects have been added to bootstrap.
bootP = getBootstrap();
Expand Down Expand Up @@ -124,7 +131,7 @@ export default async function deployMain(progname, rawArgs, powers, opts) {
}

if (provide.length) {
console.warn('provide:', provide.join(', '));
console.debug('provide:', provide.join(', '));
await E(E.G(E.G(bootP).local).http).doneLoading(provide);
}

Expand Down

0 comments on commit 11b60c1

Please sign in to comment.