Skip to content

Commit

Permalink
cli: fix skip-blocks-uploading mode of upload-bin command
Browse files Browse the repository at this point in the history
If uploadBlocks succeeded uploadIndexFiles should work based on the
currentBlockHeight.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
  • Loading branch information
AliceInHunterland committed Nov 15, 2024
1 parent 0fd9717 commit a13079a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cli/util/upload_bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,19 @@ func uploadBin(ctx *cli.Context) error {
}
fmt.Fprintln(ctx.App.Writer, "First block of latest incomplete batch uploaded to NeoFS container:", oldestMissingBlockIndex)

if !ctx.Bool("skip-blocks-uploading") {
err = uploadBlocks(ctx, p, rpc, signer, containerID, acc, attr, oldestMissingBlockIndex, uint(currentBlockHeight), homomorphicHashingDisabled, numWorkers, maxRetries)
if ctx.Bool("skip-blocks-uploading") {
err = uploadIndexFiles(ctx, p, containerID, acc, signer, uint(oldestMissingBlockIndex), attr, homomorphicHashingDisabled, maxParallelSearches, maxRetries)

Check warning on line 145 in cli/util/upload_bin.go

View check run for this annotation

Codecov / codecov/patch

cli/util/upload_bin.go#L144-L145

Added lines #L144 - L145 were not covered by tests
if err != nil {
return cli.Exit(fmt.Errorf("failed to upload blocks: %w", err), 1)
return cli.Exit(fmt.Errorf("failed to upload index files: %w", err), 1)

Check warning on line 147 in cli/util/upload_bin.go

View check run for this annotation

Codecov / codecov/patch

cli/util/upload_bin.go#L147

Added line #L147 was not covered by tests
}
return nil

Check warning on line 149 in cli/util/upload_bin.go

View check run for this annotation

Codecov / codecov/patch

cli/util/upload_bin.go#L149

Added line #L149 was not covered by tests
}

err = uploadIndexFiles(ctx, p, containerID, acc, signer, uint(oldestMissingBlockIndex), attr, homomorphicHashingDisabled, maxParallelSearches, maxRetries)
err = uploadBlocks(ctx, p, rpc, signer, containerID, acc, attr, oldestMissingBlockIndex, uint(currentBlockHeight), homomorphicHashingDisabled, numWorkers, maxRetries)
if err != nil {
return cli.Exit(fmt.Errorf("failed to upload blocks: %w", err), 1)
}
err = uploadIndexFiles(ctx, p, containerID, acc, signer, uint(currentBlockHeight), attr, homomorphicHashingDisabled, maxParallelSearches, maxRetries)

Check warning on line 156 in cli/util/upload_bin.go

View check run for this annotation

Codecov / codecov/patch

cli/util/upload_bin.go#L152-L156

Added lines #L152 - L156 were not covered by tests
if err != nil {
return cli.Exit(fmt.Errorf("failed to upload index files: %w", err), 1)
}
Expand Down

0 comments on commit a13079a

Please sign in to comment.