Skip to content

Commit

Permalink
handle case when total=0
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed Oct 10, 2023
1 parent 0724a08 commit 38b6d80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker/devnet/boost/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ sed 's|#ServiceApiInfo = ""|ServiceApiInfo = "ws://localhost:8042"|g' $BOOST_PAT
sed 's|#ExpectedSealDuration = "24h0m0s"|ExpectedSealDuration = "0h0m10s"|g' $BOOST_PATH/config.toml > $BOOST_PATH/config.toml.tmp; cp $BOOST_PATH/config.toml.tmp $BOOST_PATH/config.toml; rm $BOOST_PATH/config.toml.tmp

## run boostd-data
boostd-data run leveldb --repo $BOOST_PATH --addr=0.0.0.0:8042 &
boostd-data --vv run leveldb --repo $BOOST_PATH --addr=0.0.0.0:8042 > $BOOST_PATH/boostd-data.log &

# TODO(anteva): fixme: hack as boostd fails to start without this dir
mkdir -p /var/lib/boost/deal-staging
Expand Down
7 changes: 5 additions & 2 deletions extern/boostd-data/yugabyte/piecedoctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,11 @@ func (s *Store) ScanProgress(ctx context.Context, maddr address.Address) (*types
return nil, fmt.Errorf("getting time piece tracker was last scanned: %w", err)
}

// Calculate approximate progress
progress := float64(scanned) / float64(total)
progress := float64(1)
if total != 0 {
// Calculate approximate progress
progress = float64(scanned) / float64(total)
}

// Given that the denominator may be a little inflated, round up to 100% if we're close
if progress > 0.95 {
Expand Down

0 comments on commit 38b6d80

Please sign in to comment.