Fix err shadowing (#11296)

This commit is contained in:
Scott Miller 2021-04-07 11:25:23 -05:00 committed by GitHub
parent 7daf061216
commit 080c9ca6ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -500,7 +500,7 @@ func (d *DynamoDBBackend) HAEnabled() bool {
func (d *DynamoDBBackend) batchWriteRequests(requests []*dynamodb.WriteRequest) error { func (d *DynamoDBBackend) batchWriteRequests(requests []*dynamodb.WriteRequest) error {
for len(requests) > 0 { for len(requests) > 0 {
batchSize := int(math.Min(float64(len(requests)), 25)) batchSize := int(math.Min(float64(len(requests)), 25))
batch := map[string][]*dynamodb.WriteRequest{ d.table: requests[:batchSize] } batch := map[string][]*dynamodb.WriteRequest{d.table: requests[:batchSize]}
requests = requests[batchSize:] requests = requests[batchSize:]
var err error var err error
@ -511,19 +511,20 @@ func (d *DynamoDBBackend) batchWriteRequests(requests []*dynamodb.WriteRequest)
boff.MaxElapsedTime = 600 * time.Second boff.MaxElapsedTime = 600 * time.Second
for len(batch) > 0 { for len(batch) > 0 {
output, err := d.client.BatchWriteItem(&dynamodb.BatchWriteItemInput{ var output *dynamodb.BatchWriteItemOutput
output, err = d.client.BatchWriteItem(&dynamodb.BatchWriteItemInput{
RequestItems: batch, RequestItems: batch,
}) })
if err != nil{ if err != nil {
break break
} }
if len(output.UnprocessedItems) == 0 { if len(output.UnprocessedItems) == 0 {
break break
} else { } else {
duration := boff.NextBackOff(); duration := boff.NextBackOff()
if (duration != backoff.Stop) { if duration != backoff.Stop {
batch = output.UnprocessedItems batch = output.UnprocessedItems
time.Sleep(duration) time.Sleep(duration)
} else { } else {