Skip to content

Commit

Permalink
added EOF batch retry
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Feb 6, 2018
1 parent 0402b86 commit 5cdd3c9
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,25 @@ func (m *manager) readBatch(client *aerospike.Client, statement *dsc.QueryStatem
}
var batchPolicy = m.getBatchPolicy()
var records []*aerospike.Record
if statement.AllField {
records, err = client.BatchGet(batchPolicy, keys)
} else {
records, err = client.BatchGet(batchPolicy, keys, statement.ColumnNames()...)

maxRetries := m.Config().GetInt("maxRetries", 2)
if maxRetries == 0 {
maxRetries = 1
}
if err != nil {
return err
for i := 0; i < maxRetries; i++ {
if statement.AllField {
records, err = client.BatchGet(batchPolicy, keys)
} else {
records, err = client.BatchGet(batchPolicy, keys, statement.ColumnNames()...)
}
if err != nil {
if strings.Contains(err.Error(), "EOF") {
continue
}
return err
}
break
}

err = m.processRecords(records, keys, statement, readingHandler)
if err != nil {
return err
Expand Down

0 comments on commit 5cdd3c9

Please sign in to comment.