fix: avoid divide by zero error single node distributed setup (#10862)

This commit is contained in:
Harshavardhana
2020-11-09 20:40:39 -08:00
committed by GitHub
parent 8e8ddf7233
commit 8df6112204

View File

@@ -237,6 +237,9 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa
// Setup bandwidth throttling
peers, _ := globalEndpoints.peers()
totalNodesCount := len(peers)
if totalNodesCount == 0 {
totalNodesCount = 1 // For standalone erasure coding
}
b := target.BandwidthLimit / int64(totalNodesCount)
var headerSize int
for k, v := range putOpts.Header() {