Skip to content

Commit

Permalink
fix(cli): add more sleep between steps to ensure all actions are comp…
Browse files Browse the repository at this point in the history
…leted on the backend
  • Loading branch information
ctrlc03 committed Oct 23, 2023
1 parent d00ebd1 commit 828aeca
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/phase2cli/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,8 @@ export const handleStartOrResumeContribution = async (
`${theme.symbols.success} Contribution ${theme.text.bold(`#${lastZkeyIndex}`)} correctly downloaded`
)

await sleep(3000)

// Advance to next contribution step (COMPUTING) if not finalizing.
if (!isFinalizing) {
spinner.text = `Preparing for contribution computation...`
Expand Down Expand Up @@ -693,6 +695,9 @@ export const handleStartOrResumeContribution = async (
)}`
)

// ensure the previous step is completed
await sleep(5000)

// Advance to next contribution step (UPLOADING) if not finalizing.
if (!isFinalizing) {
spinner.text = `Preparing for uploading the contribution...`
Expand All @@ -717,6 +722,8 @@ export const handleStartOrResumeContribution = async (
} This step may take a while based on circuit size and your internet speed. Everything's fine, just be patient.`
spinner.start()

const progressBar = customProgressBar(ProgressBarType.UPLOAD, `your contribution`)

if (!isFinalizing)
await multiPartUpload(
cloudFunctions,
Expand All @@ -725,7 +732,8 @@ export const handleStartOrResumeContribution = async (
nextZkeyLocalFilePath,
Number(process.env.CONFIG_STREAM_CHUNK_SIZE_IN_MB),
ceremony.id,
participantData.tempContributionData
participantData.tempContributionData,
progressBar
)
else
await multiPartUpload(
Expand All @@ -742,6 +750,9 @@ export const handleStartOrResumeContribution = async (
} correctly saved to storage`
)

// small sleep to ensure the previous step is completed
await sleep(5000)

// Advance to next contribution step (VERIFYING) if not finalizing.
if (!isFinalizing) {
spinner.text = `Preparing for requesting contribution verification...`
Expand Down

0 comments on commit 828aeca

Please sign in to comment.