mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-02-01 23:40:35 +00:00
cli: adjust error of upload-bin
command
Miscalculation leads to negative values in errors: ``` 2024-10-17 11:26:56.790 failed to fetch the latest missing block index from container: search of index files failed for batch with indexes from -260000 to -250000: error during object IDs iteration: context deadline exceeded ``` Close #3621 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
14ea5a8d32
commit
87bbff9831
1 changed files with 3 additions and 2 deletions
|
@ -205,6 +205,7 @@ func retry(action func() error) error {
|
||||||
|
|
||||||
type searchResult struct {
|
type searchResult struct {
|
||||||
startIndex int
|
startIndex int
|
||||||
|
endIndex int
|
||||||
numOIDs int
|
numOIDs int
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
@ -248,14 +249,14 @@ func fetchLatestMissingBlockIndex(ctx context.Context, p *pool.Pool, containerID
|
||||||
objectIDs, err = neofs.ObjectSearch(ctx, p, priv, containerID.String(), prm)
|
objectIDs, err = neofs.ObjectSearch(ctx, p, priv, containerID.String(), prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
results[i] = searchResult{startIndex: startIndex, numOIDs: len(objectIDs), err: err}
|
results[i] = searchResult{startIndex: startIndex, endIndex: endIndex, numOIDs: len(objectIDs), err: err}
|
||||||
}(i, startIndex, endIndex)
|
}(i, startIndex, endIndex)
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
for i := len(results) - 1; i >= 0; i-- {
|
for i := len(results) - 1; i >= 0; i-- {
|
||||||
if results[i].err != nil {
|
if results[i].err != nil {
|
||||||
return 0, fmt.Errorf("search of index files failed for batch with indexes from %d to %d: %w", batch*searchBatchSize, (batch+1)*searchBatchSize, results[i].err)
|
return 0, fmt.Errorf("search of index files failed for batch with indexes from %d to %d: %w", results[i].startIndex, results[i].endIndex-1, results[i].err)
|
||||||
}
|
}
|
||||||
if results[i].numOIDs < searchBatchSize {
|
if results[i].numOIDs < searchBatchSize {
|
||||||
emptyBatchFound = true
|
emptyBatchFound = true
|
||||||
|
|
Loading…
Add table
Reference in a new issue