* lib/model: Adjust blocks reported in usage reporting (fixes #5995) * Use variables, fix go.mod
This commit is contained in:
committed by
GitHub
parent
5e31e6356f
commit
8fb576ed54
@@ -982,8 +982,9 @@ func (f *sendReceiveFolder) renameFile(cur, source, target protocol.FileInfo, db
|
||||
}
|
||||
|
||||
blockStatsMut.Lock()
|
||||
blockStats["total"] += len(target.Blocks)
|
||||
blockStats["renamed"] += len(target.Blocks)
|
||||
minBlocksPerBlock := target.BlockSize() / protocol.MinBlockSize
|
||||
blockStats["total"] += len(target.Blocks) * minBlocksPerBlock
|
||||
blockStats["renamed"] += len(target.Blocks) * minBlocksPerBlock
|
||||
blockStatsMut.Unlock()
|
||||
|
||||
// The file was renamed, so we have handled both the necessary delete
|
||||
@@ -1559,15 +1560,16 @@ func (f *sendReceiveFolder) finisherRoutine(in <-chan *sharedPullerState, dbUpda
|
||||
if err != nil {
|
||||
f.newPullError(state.file.Name, err)
|
||||
} else {
|
||||
minBlocksPerBlock := state.file.BlockSize() / protocol.MinBlockSize
|
||||
blockStatsMut.Lock()
|
||||
blockStats["total"] += state.reused + state.copyTotal + state.pullTotal
|
||||
blockStats["reused"] += state.reused
|
||||
blockStats["pulled"] += state.pullTotal
|
||||
blockStats["total"] += (state.reused + state.copyTotal + state.pullTotal) * minBlocksPerBlock
|
||||
blockStats["reused"] += state.reused * minBlocksPerBlock
|
||||
blockStats["pulled"] += state.pullTotal * minBlocksPerBlock
|
||||
// copyOriginShifted is counted towards copyOrigin due to progress bar reasons
|
||||
// for reporting reasons we want to separate these.
|
||||
blockStats["copyOrigin"] += state.copyOrigin - state.copyOriginShifted
|
||||
blockStats["copyOriginShifted"] += state.copyOriginShifted
|
||||
blockStats["copyElsewhere"] += state.copyTotal - state.copyOrigin
|
||||
blockStats["copyOrigin"] += (state.copyOrigin - state.copyOriginShifted) * minBlocksPerBlock
|
||||
blockStats["copyOriginShifted"] += state.copyOriginShifted * minBlocksPerBlock
|
||||
blockStats["copyElsewhere"] += (state.copyTotal - state.copyOrigin) * minBlocksPerBlock
|
||||
blockStatsMut.Unlock()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user